ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilApc Class Reference

Class ilApc. More...

+ Inheritance diagram for ilApc:
+ Collaboration diagram for ilApc:

Public Member Functions

 exists ($key)
 
 set ($key, $serialized_value, $ttl=0)
 
 get ($key)
 
 delete ($key)
 
 flush ()
 
 serialize ($value)
 
 unserialize ($serialized_value)
 
 getInfo ()
 
 isValid ($key)
 
- Public Member Functions inherited from ilGlobalCacheService
 __construct ($service_id, $component)
 
 unserialize ($serialized_value)
 
 get ($key)
 
 set ($key, $serialized_value, $ttl=null)
 
 serialize ($value)
 
 getServiceId ()
 
 setServiceId ($service_id)
 
 getComponent ()
 
 setComponent ($component)
 
 isActive ()
 
 isInstallable ()
 
 returnKey ($key)
 
 getInfo ()
 
 getInstallationFailureReason ()
 
 exists ($key)
 
 delete ($key)
 
 flush ()
 
 setServiceType ($service_type)
 
 getServiceType ()
 
 setValid ($key)
 Declare a key as valid. More...
 
 setInvalid ($key=null)
 Set the key as invalid. More...
 
 isValid ($key)
 Checks whether the cache key is valid or not. More...
 

Data Fields

const MIN_MEMORY = 16
 
const CACHE_ID = 'user'
 

Protected Member Functions

 getActive ()
 
 getInstallable ()
 
 getMemoryLimit ()
 
 getMinMemory ()
 
- Protected Member Functions inherited from ilGlobalCacheService
 getActive ()
 
 getInstallable ()
 
 getMemoryLimit ()
 
 getMinMemory ()
 
 checkMemory ()
 

Additional Inherited Members

- Protected Attributes inherited from ilGlobalCacheService
 $current_time = 0
 
 $valid_keys = array()
 
 $service_id = ''
 
 $component = ''
 
 $service_type = ilGlobalCache::TYPE_STATIC
 
 $valid_key_hash = ''
 
- Static Protected Attributes inherited from ilGlobalCacheService
static $active = array()
 
static $installable = array()
 

Detailed Description

Class ilApc.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
1.0.0

Definition at line 14 of file class.ilApc.php.

Member Function Documentation

◆ delete()

ilApc::delete (   $key)
Parameters
$key
Returns
bool|string[]

Definition at line 61 of file class.ilApc.php.

References ilGlobalCacheService\returnKey().

61  {
62  return apcu_delete($this->returnKey($key));
63  }
+ Here is the call graph for this function:

◆ exists()

ilApc::exists (   $key)
Parameters
$key
Returns
bool

Definition at line 25 of file class.ilApc.php.

References ilGlobalCacheService\returnKey().

25  {
26  if (function_exists('apcu_exists')) {
27  return apcu_exists($this->returnKey($key));
28  } else {
29  return apcu_fetch($this->returnKey($key));
30  }
31  }
+ Here is the call graph for this function:

◆ flush()

ilApc::flush ( )
Returns
bool

Definition at line 69 of file class.ilApc.php.

69  {
70  return apcu_clear_cache();
71  }

◆ get()

ilApc::get (   $key)
Parameters
$key
Returns
mixed

Definition at line 51 of file class.ilApc.php.

References ilGlobalCacheService\returnKey().

51  {
52  return apcu_fetch($this->returnKey($key));
53  }
+ Here is the call graph for this function:

◆ getActive()

ilApc::getActive ( )
protected

Definition at line 127 of file class.ilApc.php.

127  {
128  return function_exists('apcu_store');
129  }

◆ getInfo()

ilApc::getInfo ( )
Returns
array

Definition at line 97 of file class.ilApc.php.

References array, ilGlobalCacheService\getComponent(), and ilGlobalCacheService\getServiceId().

97  {
98  $return = array();
99 
100  $cache_info = apc_cache_info();
101 
102  unset($cache_info['cache_list']);
103  unset($cache_info['slot_distribution']);
104 
105  $return['__cache_info'] = array(
106  'apc.enabled' => ini_get('apc.enabled'),
107  'apc.shm_size' => ini_get('apc.shm_size'),
108  'apc.shm_segments' => ini_get('apc.shm_segments'),
109  'apc.gc_ttl' => ini_get('apc.gc_ttl'),
110  'apc.user_ttl' => ini_get('apc.ttl'),
111  'info' => $cache_info,
112  );
113 
114  $cache_info = apc_cache_info();
115  foreach ($cache_info['cache_list'] as $dat) {
116  $key = $dat['key'];
117 
118  if (preg_match('/' . $this->getServiceId() . '_' . $this->getComponent() . '/', $key)) {
119  $return[$key] = apc_fetch($key);
120  }
121  }
122 
123  return $return;
124  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getInstallable()

ilApc::getInstallable ( )
protected
Returns
bool

Definition at line 135 of file class.ilApc.php.

135  {
136  return function_exists('apcu_store');
137  }

◆ getMemoryLimit()

ilApc::getMemoryLimit ( )
protected
Returns
string

Definition at line 143 of file class.ilApc.php.

References ilRuntime\getInstance(), and getMinMemory().

143  {
144  if (ilRuntime::getInstance()->isHHVM()) {
145  return $this->getMinMemory() . 'M';
146  }
147 
148  return ini_get('apc.shm_size');
149  }
static getInstance()
getMinMemory()
+ Here is the call graph for this function:

◆ getMinMemory()

ilApc::getMinMemory ( )
protected
Returns
int

Definition at line 155 of file class.ilApc.php.

Referenced by getMemoryLimit().

155  {
156  return self::MIN_MEMORY;
157  }
+ Here is the caller graph for this function:

◆ isValid()

ilApc::isValid (   $key)

Definition at line 163 of file class.ilApc.php.

163  {
164  return true;
165  }

◆ serialize()

ilApc::serialize (   $value)
Parameters
$value
Returns
mixed|string

Definition at line 79 of file class.ilApc.php.

79  {
80  return ($value);
81  }

◆ set()

ilApc::set (   $key,
  $serialized_value,
  $ttl = 0 
)
Parameters
$key
$serialized_value
int$ttl
Returns
array|bool

Definition at line 41 of file class.ilApc.php.

References ilGlobalCacheService\returnKey().

41  {
42  return apcu_store($this->returnKey($key), $serialized_value, $ttl);
43  }
+ Here is the call graph for this function:

◆ unserialize()

ilApc::unserialize (   $serialized_value)
Parameters
$serialized_value
Returns
mixed

Definition at line 89 of file class.ilApc.php.

89  {
90  return ($serialized_value);
91  }

Field Documentation

◆ CACHE_ID

const ilApc::CACHE_ID = 'user'

Definition at line 17 of file class.ilApc.php.

◆ MIN_MEMORY

const ilApc::MIN_MEMORY = 16

Definition at line 16 of file class.ilApc.php.


The documentation for this class was generated from the following file: