ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMemcache Class Reference

Class ilMemcache. More...

+ Inheritance diagram for ilMemcache:
+ Collaboration diagram for ilMemcache:

Public Member Functions

 exists ($key)
 
 set ($key, $serialized_value, $ttl=null)
 
 get ($key)
 
 delete ($key)
 
 flush ($complete=false)
 
 getInstallationFailureReason ()
 
 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 ($complete=false)
 
 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...
 

Protected Member Functions

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

Static Protected Attributes

static $memcache_object
 
- Static Protected Attributes inherited from ilGlobalCacheService
static $active = array()
 
static $installable = array()
 

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 = ''
 

Detailed Description

Class ilMemcache.

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

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

Member Function Documentation

◆ delete()

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

Reimplemented from ilGlobalCacheService.

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

105 {
106 return $this->getMemcacheObject()->delete($this->returnKey($key));
107 }
$key
Definition: croninfo.php:18

References $key, getMemcacheObject(), and ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ exists()

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

Reimplemented from ilGlobalCacheService.

Definition at line 68 of file class.ilMemcache.php.

69 {
70 return $this->getMemcacheObject()->get($this->returnKey($key)) != null;
71 }

References $key, getMemcacheObject(), and ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ flush()

ilMemcache::flush (   $complete = false)
Parameters
bool$complete
Returns
bool

Reimplemented from ilGlobalCacheService.

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

116 {
117 // currently a partial flushing is missing
118 return $this->getMemcacheObject()->flush();
119 }

References getMemcacheObject().

+ Here is the call graph for this function:

◆ get()

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

Reimplemented from ilGlobalCacheService.

Definition at line 93 of file class.ilMemcache.php.

94 {
95 return $this->getMemcacheObject()->get($this->returnKey($key));
96 }

References $key, getMemcacheObject(), and ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ getActive()

ilMemcache::getActive ( )
protected
Returns
bool

Reimplemented from ilGlobalCacheService.

Definition at line 125 of file class.ilMemcache.php.

126 {
127 if ($this->getInstallable()) {
128 $stats = $this->getMemcacheObject()->getStats();
129
130 if (!is_array($stats)) {
131 return false;
132 }
133
134 foreach ($stats as $server) {
135 if ($server['pid'] > 0) {
136 return true;
137 }
138 }
139
140 return false;
141 }
142
143 return false;
144 }
$server
Definition: sabredav.php:48

References $server, Sabre\VObject\$stats, getInstallable(), and getMemcacheObject().

+ Here is the call graph for this function:

◆ getInfo()

ilMemcache::getInfo ( )
Returns
array

Reimplemented from ilGlobalCacheService.

Definition at line 198 of file class.ilMemcache.php.

199 {
200 if (self::isInstallable()) {
201 $return = array();
202 $return['__cache_info'] = $this->getMemcacheObject()->getStats();
203 foreach ($this->getMemcacheObject()->getAllKeys() as $key) {
204 $return[$key] = $this->getMemcacheObject()->get($key);
205 }
206
207 return $return;
208 }
209 }

References $key, and getMemcacheObject().

+ Here is the call graph for this function:

◆ getInstallable()

ilMemcache::getInstallable ( )
protected
Returns
bool

Reimplemented from ilGlobalCacheService.

Definition at line 150 of file class.ilMemcache.php.

151 {
152 return class_exists('Memcached');
153 }

Referenced by getActive().

+ Here is the caller graph for this function:

◆ getInstallationFailureReason()

ilMemcache::getInstallationFailureReason ( )
Returns
string

Reimplemented from ilGlobalCacheService.

Definition at line 159 of file class.ilMemcache.php.

160 {
161 if ($this->getMemcacheObject() instanceof Memcached) {
162 $stats = $this->getMemcacheObject()->getStats();
163
164 if (!$stats[self::STD_SERVER . ':' . self::STD_PORT]['pid'] > 0) {
165 return 'No Memcached-Server available';
166 }
167 }
168
169 return parent::getInstallationFailureReason();
170 }

References Sabre\VObject\$stats, and getMemcacheObject().

+ Here is the call graph for this function:

◆ getMemcacheObject()

ilMemcache::getMemcacheObject ( )
protected
Returns
Memcached

Definition at line 57 of file class.ilMemcache.php.

58 {
60 }
static $memcache_object

References $memcache_object.

Referenced by delete(), exists(), flush(), get(), getActive(), getInfo(), getInstallationFailureReason(), and set().

+ Here is the caller graph for this function:

◆ isValid()

ilMemcache::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 215 of file class.ilMemcache.php.

216 {
217 return true;
218 }

◆ serialize()

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

Reimplemented from ilGlobalCacheService.

Definition at line 178 of file class.ilMemcache.php.

179 {
180 return serialize($value);
181 }

References serialize().

Referenced by serialize().

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

◆ set()

ilMemcache::set (   $key,
  $serialized_value,
  $ttl = null 
)
Parameters
$key
$serialized_value
null | int$ttl
Returns
bool

Reimplemented from ilGlobalCacheService.

Definition at line 81 of file class.ilMemcache.php.

82 {
83 return $this->getMemcacheObject()
84 ->set($this->returnKey($key), $serialized_value, (int) $ttl);
85 }

References $key, getMemcacheObject(), and ilGlobalCacheService\returnKey().

+ Here is the call graph for this function:

◆ unserialize()

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

Reimplemented from ilGlobalCacheService.

Definition at line 189 of file class.ilMemcache.php.

190 {
191 return unserialize($serialized_value);
192 }
unserialize($serialized_value)

References unserialize().

Referenced by unserialize().

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

Field Documentation

◆ $memcache_object

ilMemcache::$memcache_object
staticprotected

Definition at line 18 of file class.ilMemcache.php.

Referenced by getMemcacheObject().


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