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)
 Checks whether the cache key is valid or not.This method exists only for legacy reasons and has only a real function in combination with XCache.
Parameters
string$keyThe key which should be checked.
Returns
bool True if the key is valid otherwise false.
More...
 
- 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 ()
 @inheritDoc More...
 
- 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.

@beta

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[]

Reimplemented from ilGlobalCacheService.

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

65 {
66 return apcu_delete($this->returnKey($key));
67 }
$key
Definition: croninfo.php:18

References $key, and ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ exists()

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

Reimplemented from ilGlobalCacheService.

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

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 }

References $key, and ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ flush()

ilApc::flush ( )
Returns
bool

Reimplemented from ilGlobalCacheService.

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

74 {
75 return apcu_clear_cache();
76 }

◆ get()

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

Reimplemented from ilGlobalCacheService.

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

54 {
55 return apcu_fetch($this->returnKey($key));
56 }

References $key, and ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ getActive()

ilApc::getActive ( )
protected
Returns
bool

Reimplemented from ilGlobalCacheService.

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

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

◆ getInfo()

ilApc::getInfo ( )
Returns
array

Reimplemented from ilGlobalCacheService.

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

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 }

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

+ Here is the call graph for this function:

◆ getInstallable()

ilApc::getInstallable ( )
protected
Returns
bool

Reimplemented from ilGlobalCacheService.

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

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

◆ getMemoryLimit()

ilApc::getMemoryLimit ( )
protected
Returns
string

Reimplemented from ilGlobalCacheService.

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

154 {
155 if (ilRuntime::getInstance()->isHHVM()) {
156 return $this->getMinMemory() . 'M';
157 }
158
159 return ini_get('apc.shm_size');
160 }
getMinMemory()
@inheritDoc
static getInstance()

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

+ Here is the call graph for this function:

◆ getMinMemory()

ilApc::getMinMemory ( )
protected

@inheritDoc

Reimplemented from ilGlobalCacheService.

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

167 {
168 return self::MIN_MEMORY;
169 }
const MIN_MEMORY
Definition: class.ilApc.php:16

References MIN_MEMORY.

Referenced by getMemoryLimit().

+ Here is the caller graph for this function:

◆ isValid()

ilApc::isValid (   $key)

Checks whether the cache key is valid or not.This method exists only for legacy reasons and has only a real function in combination with XCache.

Parameters
string$keyThe key which should be checked.
Returns
bool True if the key is valid otherwise false.

Reimplemented from ilGlobalCacheService.

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

176 {
177 return true;
178 }

◆ serialize()

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

Reimplemented from ilGlobalCacheService.

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

Reimplemented from ilGlobalCacheService.

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

43 {
44 return apcu_store($this->returnKey($key), $serialized_value, $ttl);
45 }

References $key, and ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ unserialize()

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

Reimplemented from ilGlobalCacheService.

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.

Referenced by getMinMemory().


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