ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ()
 
 getInstallationFailureReason ()
 
 serialize ($value)
 
 unserialize ($serialized_value)
 
 getInfo ()
 
- Public Member Functions inherited from ilGlobalCacheService
 __construct ($service_id, $component)
 
 __destruct ()
 
 unserialize ($serialized_value)
 
 get ($key)
 
 set ($key, $serialized_value, $ttl=NULL)
 
 serialize ($value)
 
 getServiceId ()
 
 setServiceId ($service_id)
 
 setValid ($key)
 
 getComponent ()
 
 setComponent ($component)
 
 setInvalid ($key=NULL)
 
 isValid ($key)
 
 isActive ()
 
 isInstallable ()
 
 returnKey ($key)
 
 getInfo ()
 
 getInstallationFailureReason ()
 
 exists ($key)
 
 delete ($key)
 
 flush ()
 
 setServiceType ($service_type)
 
 getServiceType ()
 

Protected Member Functions

 getMemcacheObject ()
 
 getActive ()
 
 getInstallable ()
 
- Protected Member Functions inherited from ilGlobalCacheService
 saveValid ()
 
 readValid ()
 
 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 92 of file class.ilMemcache.php.

92 {
93 return $this->getMemcacheObject()->delete($this->returnKey($key));
94 }

References 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 60 of file class.ilMemcache.php.

60 {
61 return $this->getMemcacheObject()->get($this->returnKey($key)) != NULL;
62 }

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

+ Here is the call graph for this function:

◆ flush()

ilMemcache::flush ( )
Returns
bool

Reimplemented from ilGlobalCacheService.

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

100 {
101 return $this->getMemcacheObject()->flush();
102 }

References getMemcacheObject().

+ Here is the call graph for this function:

◆ get()

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

Reimplemented from ilGlobalCacheService.

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

82 {
83 return $this->getMemcacheObject()->get($this->returnKey($key));
84 }

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

+ Here is the call graph for this function:

◆ getActive()

ilMemcache::getActive ( )
protected
Returns
bool

Reimplemented from ilGlobalCacheService.

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

108 {
109 if ($this->getInstallable()) {
110 $stats = $this->getMemcacheObject()->getStats();
111
112 if (!is_array($stats)) {
113 return false;
114 }
115
116 foreach ($stats as $server) {
117 if ($server['pid'] > 0) {
118 return true;
119 }
120 }
121
122 return false;
123 }
124
125 return false;
126 }
$server

References $server, getInstallable(), and getMemcacheObject().

+ Here is the call graph for this function:

◆ getInfo()

ilMemcache::getInfo ( )
Returns
array

Reimplemented from ilGlobalCacheService.

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

176 {
177 if (self::isInstallable()) {
178 $return = array();
179 $return['__cache_info'] = $this->getMemcacheObject()->getStats();
180 foreach ($this->getMemcacheObject()->getAllKeys() as $key) {
181 $return[$key] = $this->getMemcacheObject()->get($key);
182 }
183
184 return $return;
185 }
186 }

References getMemcacheObject().

+ Here is the call graph for this function:

◆ getInstallable()

ilMemcache::getInstallable ( )
protected
Returns
bool

Reimplemented from ilGlobalCacheService.

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

132 {
133 return class_exists('Memcached');
134 }

Referenced by getActive().

+ Here is the caller graph for this function:

◆ getInstallationFailureReason()

ilMemcache::getInstallationFailureReason ( )
Returns
string

Reimplemented from ilGlobalCacheService.

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

140 {
141 if ($this->getMemcacheObject() instanceof Memcached) {
142 $stats = $this->getMemcacheObject()->getStats();
143
144 if (! $stats[self::STD_SERVER . ':' . self::STD_PORT]['pid'] > 0) {
145 return 'No Memcached-Server available';
146 }
147 }
148
149 return parent::getInstallationFailureReason();
150 }

References getMemcacheObject().

+ Here is the call graph for this function:

◆ getMemcacheObject()

ilMemcache::getMemcacheObject ( )
protected
Returns
Memcached

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

50 {
52 }
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:

◆ serialize()

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

Reimplemented from ilGlobalCacheService.

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

158 {
159 return serialize($value);
160 }

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

72 {
73 return $this->getMemcacheObject()->set($this->returnKey($key), $serialized_value, (int)$ttl);
74 }

References 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 168 of file class.ilMemcache.php.

168 {
169 return unserialize($serialized_value);
170 }
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 17 of file class.ilMemcache.php.

Referenced by getMemcacheObject().


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