ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 64 of file class.ilApc.php.

References $key, and ilGlobalCacheService\returnKey().

65  {
66  return apcu_delete($this->returnKey($key));
67  }
$key
Definition: croninfo.php:18
+ 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 $key, and ilGlobalCacheService\returnKey().

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

◆ flush()

ilApc::flush ( )
Returns
bool

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

74  {
75  return apcu_clear_cache();
76  }

◆ get()

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

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

References $key, and ilGlobalCacheService\returnKey().

54  {
55  return apcu_fetch($this->returnKey($key));
56  }
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ getActive()

ilApc::getActive ( )
protected

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

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

◆ getInfo()

ilApc::getInfo ( )
Returns
array

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

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

105  {
106  $return = array();
107 
108  $cache_info = apc_cache_info();
109 
110  unset($cache_info['cache_list']);
111  unset($cache_info['slot_distribution']);
112 
113  $return['__cache_info'] = array(
114  'apc.enabled' => ini_get('apc.enabled'),
115  'apc.shm_size' => ini_get('apc.shm_size'),
116  'apc.shm_segments' => ini_get('apc.shm_segments'),
117  'apc.gc_ttl' => ini_get('apc.gc_ttl'),
118  'apc.user_ttl' => ini_get('apc.ttl'),
119  'info' => $cache_info,
120  );
121 
122  $cache_info = apc_cache_info();
123  foreach ($cache_info['cache_list'] as $dat) {
124  $key = $dat['key'];
125 
126  if (preg_match('/' . $this->getServiceId() . '_' . $this->getComponent() . '/', $key)) {
127  $return[$key] = apc_fetch($key);
128  }
129  }
130 
131  return $return;
132  }
Create styles array
The data for the language used.
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ getInstallable()

ilApc::getInstallable ( )
protected
Returns
bool

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

145  {
146  return function_exists('apcu_store');
147  }

◆ getMemoryLimit()

ilApc::getMemoryLimit ( )
protected
Returns
string

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

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

154  {
155  if (ilRuntime::getInstance()->isHHVM()) {
156  return $this->getMinMemory() . 'M';
157  }
158 
159  return ini_get('apc.shm_size');
160  }
static getInstance()
getMinMemory()
+ Here is the call graph for this function:

◆ getMinMemory()

ilApc::getMinMemory ( )
protected

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

Referenced by getMemoryLimit().

167  {
168  return self::MIN_MEMORY;
169  }
+ Here is the caller graph for this function:

◆ isValid()

ilApc::isValid (   $key)

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

176  {
177  return true;
178  }

◆ serialize()

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

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

85  {
86  return ($value);
87  }

◆ set()

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

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

References $key, and ilGlobalCacheService\returnKey().

43  {
44  return apcu_store($this->returnKey($key), $serialized_value, $ttl);
45  }
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ unserialize()

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

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

96  {
97  return ($serialized_value);
98  }

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: