ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilXcache Class Reference

Class ilXcache. More...

+ Inheritance diagram for ilXcache:
+ Collaboration diagram for ilXcache:

Public Member Functions

 __construct ($serviceId, $component)
 ilXcache constructor. More...
 
 exists ($key)
 
 set ($key, $serialized_value, $ttl=null)
 
 get ($key)
 
 delete ($key)
 
 flush ()
 
 serialize ($value)
 
 unserialize ($serialized_value)
 
 getInfo ()
 
 __destruct ()
 
- 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 = 32
 

Protected Member Functions

 getActive ()
 
 getInstallable ()
 
 getMemoryLimit ()
 
 getMinMemory ()
 
 saveValid ()
 
 readValid ()
 
- 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 ilXcache.

Concrete XCache implementation.

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

Definition at line 12 of file class.ilXcache.php.

Constructor & Destructor Documentation

◆ __construct()

ilXcache::__construct (   $serviceId,
  $component 
)

ilXcache constructor.

Parameters
$serviceId
$component

Reimplemented from ilGlobalCacheService.

Definition at line 23 of file class.ilXcache.php.

24 {
25 parent::__construct($serviceId, $component);
26 $this->readValid();
27 }

References ilGlobalCacheService\$component, and readValid().

+ Here is the call graph for this function:

◆ __destruct()

ilXcache::__destruct ( )

Definition at line 193 of file class.ilXcache.php.

194 {
195 $this->saveValid();
196 }

References saveValid().

+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilXcache::delete (   $key)
Parameters
$key
Returns
bool

Reimplemented from ilGlobalCacheService.

Definition at line 70 of file class.ilXcache.php.

71 {
72 return xcache_unset($this->returnKey($key));
73 }
$key
Definition: croninfo.php:18

References $key, and ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ exists()

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

Reimplemented from ilGlobalCacheService.

Definition at line 35 of file class.ilXcache.php.

36 {
37 return xcache_isset($this->returnKey($key));
38 }

References $key, and ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ flush()

ilXcache::flush ( )
Returns
bool

Reimplemented from ilGlobalCacheService.

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

80 {
81 $_SERVER["PHP_AUTH_USER"] = "xcache";
82 $_SERVER["PHP_AUTH_PW"] = "xcache";
83
84 xcache_clear_cache(XC_TYPE_VAR, 0);
85
86 return true;
87 }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_SERVER.

◆ get()

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

Reimplemented from ilGlobalCacheService.

Definition at line 59 of file class.ilXcache.php.

60 {
61 return xcache_get($this->returnKey($key));
62 }

References $key, and ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ getActive()

ilXcache::getActive ( )
protected
Returns
bool

Reimplemented from ilGlobalCacheService.

Definition at line 115 of file class.ilXcache.php.

116 {
117 $function_exists = function_exists('xcache_set');
118 $var_size = ini_get('xcache.var_size') != '0M';
119 $var_count = ini_get('xcache.var_count') > 0;
120 $api = (php_sapi_name() !== 'cli');
121
122 $active = $function_exists and $var_size and $var_count and $api;
123
124 return $active;
125 }

References ilGlobalCacheService\$active.

◆ getInfo()

ilXcache::getInfo ( )
Returns
array

Reimplemented from ilGlobalCacheService.

Definition at line 140 of file class.ilXcache.php.

141 {
142 if ($this->isActive()) {
143 return xcache_info(XC_TYPE_VAR, 0);
144 }
145 }

References ilGlobalCacheService\isActive().

+ Here is the call graph for this function:

◆ getInstallable()

ilXcache::getInstallable ( )
protected
Returns
bool

Reimplemented from ilGlobalCacheService.

Definition at line 131 of file class.ilXcache.php.

132 {
133 return function_exists('xcache_set');
134 }

◆ getMemoryLimit()

ilXcache::getMemoryLimit ( )
protected
Returns
int|string

Reimplemented from ilGlobalCacheService.

Definition at line 151 of file class.ilXcache.php.

152 {
153 return ini_get('xcache.var_size');
154 }

◆ getMinMemory()

ilXcache::getMinMemory ( )
protected
Returns
int

Reimplemented from ilGlobalCacheService.

Definition at line 160 of file class.ilXcache.php.

161 {
162 return self::MIN_MEMORY;
163 }
const MIN_MEMORY

References MIN_MEMORY.

◆ readValid()

ilXcache::readValid ( )
protected
Returns
void

@description set self::$valid_keys from GlobalCache

Definition at line 185 of file class.ilXcache.php.

186 {
187 if ($this->isActive() && $this->isInstallable()) {
188 $this->valid_keys = $this->unserialize($this->get('valid_keys'));
189 $this->valid_key_hash = md5(serialize($this->valid_keys));
190 }
191 }
serialize($value)
unserialize($serialized_value)

References ilGlobalCacheService\isActive(), ilGlobalCacheService\isInstallable(), serialize(), and unserialize().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveValid()

ilXcache::saveValid ( )
protected
Returns
void

@description save self::$valid_keys to GlobalCache

Definition at line 170 of file class.ilXcache.php.

171 {
172 if ($this->isActive()) {
173 if ($this->valid_key_hash != md5(serialize($this->valid_keys))) {
174 $this->set('valid_keys', $this->serialize($this->valid_keys));
175 }
176 }
177 }

References ilGlobalCacheService\isActive(), and serialize().

Referenced by __destruct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize()

ilXcache::serialize (   $value)
Parameters
$value
Returns
mixed

Reimplemented from ilGlobalCacheService.

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

96 {
97 return serialize($value);
98 }

References serialize().

Referenced by readValid(), saveValid(), and serialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set()

ilXcache::set (   $key,
  $serialized_value,
  $ttl = null 
)
Parameters
$key
$serialized_value
null$ttl
Returns
bool

Reimplemented from ilGlobalCacheService.

Definition at line 48 of file class.ilXcache.php.

49 {
50 return xcache_set($this->returnKey($key), $serialized_value, $ttl);
51 }

References $key, and ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ unserialize()

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

Reimplemented from ilGlobalCacheService.

Definition at line 106 of file class.ilXcache.php.

107 {
108 return unserialize($serialized_value);
109 }

References unserialize().

Referenced by readValid(), and unserialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ MIN_MEMORY

const ilXcache::MIN_MEMORY = 32

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

Referenced by getMinMemory().


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