ILIAS  release_8 Revision v8.24
ilMemcache Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 exists (string $key)
 
 set (string $key, $serialized_value, int $ttl=null)
 
 get (string $key)
 
 delete (string $key)
 
 flush (bool $complete=false)
 
 getInstallationFailureReason ()
 
 serialize ($value)
 
 unserialize ($serialized_value)
 
 getInfo ()
 
 isValid (string $key)
 Checks whether the cache key is valid or not. More...
 
- Public Member Functions inherited from ilGlobalCacheService
 __construct (string $service_id, string $component)
 ilGlobalCacheService constructor. More...
 
 unserialize ($serialized_value)
 
 get (string $key)
 
 set (string $key, $serialized_value, int $ttl=null)
 
 serialize ($value)
 
 getServiceId ()
 
 setServiceId (string $service_id)
 
 getComponent ()
 
 setComponent (string $component)
 
 isActive ()
 
 isInstallable ()
 
 returnKey (string $key)
 
 getInfo ()
 
 getInstallationFailureReason ()
 
 exists (string $key)
 
 delete (string $key)
 
 flush (bool $complete=false)
 
 setServiceType (int $service_type)
 
 getServiceType ()
 
 setValid (string $key)
 Declare a key as valid. More...
 
 isValid (string $key)
 Checks whether the cache key is valid or not. More...
 
 unserialize ($serialized_value)
 
 get (string $key)
 
 set (string $key, $serialized_value, int $ttl=null)
 
 getServiceId ()
 
 setServiceId (string $service_id)
 
 getComponent ()
 
 setComponent (string $component)
 
 isActive ()
 
 isInstallable ()
 
 returnKey (string $key)
 
 getInfo ()
 
 getInstallationFailureReason ()
 
 exists (string $key)
 
 delete (string $key)
 
 flush (bool $complete=false)
 
 setServiceType (int $service_type)
 
 getServiceType ()
 
 setValid (string $key)
 Declare a key as valid. More...
 
 isValid (string $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 Memcached $memcache_object = null
 
- Static Protected Attributes inherited from ilGlobalCacheService
static array $active = array()
 
static array $installable = array()
 

Additional Inherited Members

- Protected Attributes inherited from ilGlobalCacheService
int $current_time = 0
 
array $valid_keys = array()
 
string $service_id = ''
 
string $component = ''
 
int $service_type = ilGlobalCache::TYPE_STATIC
 
string $valid_key_hash = ''
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 24 of file class.ilMemcache.php.

Member Function Documentation

◆ delete()

ilMemcache::delete ( string  $key)

Reimplemented from ilGlobalCacheService.

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

83 : bool
84 {
85 return $this->getMemcacheObject()->delete($this->returnKey($key));
86 }
string $key
Consumer key/client ID value.
Definition: System.php:193

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

+ Here is the call graph for this function:

◆ exists()

ilMemcache::exists ( string  $key)

Reimplemented from ilGlobalCacheService.

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

64 : bool
65 {
66 return $this->getMemcacheObject()->get($this->returnKey($key)) !== null;
67 }

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

+ Here is the call graph for this function:

◆ flush()

ilMemcache::flush ( bool  $complete = false)

Reimplemented from ilGlobalCacheService.

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

88 : bool
89 {
90 return $this->getMemcacheObject()->flush();
91 }

References getMemcacheObject().

+ Here is the call graph for this function:

◆ get()

ilMemcache::get ( string  $key)
Returns
mixed

Reimplemented from ilGlobalCacheService.

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

79 {
80 return $this->getMemcacheObject()->get($this->returnKey($key));
81 }

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

+ Here is the call graph for this function:

◆ getActive()

ilMemcache::getActive ( )
protected

Reimplemented from ilGlobalCacheService.

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

93 : bool
94 {
95 if ($this->getInstallable()) {
96 $stats = $this->getMemcacheObject()->getStats();
97
98 if (!is_array($stats)) {
99 return false;
100 }
101
102 foreach ($stats as $server) {
103 if ((int) $server['pid'] > 1) {
104 return true;
105 }
106 }
107
108 return false;
109 }
110
111 return false;
112 }
$server

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

+ Here is the call graph for this function:

◆ getInfo()

ilMemcache::getInfo ( )

Reimplemented from ilGlobalCacheService.

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

151 : array
152 {
153 $return = [];
154 if ($this->isInstallable()) {
155 $return['__cache_info'] = $this->getMemcacheObject()->getStats();
156 foreach ($this->getMemcacheObject()->getAllKeys() as $key) {
157 $return[$key] = $this->getMemcacheObject()->get($key);
158 }
159 }
160 return $return;
161 }

References ILIAS\LTI\ToolProvider\$key, getMemcacheObject(), and ilGlobalCacheService\isInstallable().

+ Here is the call graph for this function:

◆ getInstallable()

ilMemcache::getInstallable ( )
protected

Reimplemented from ilGlobalCacheService.

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

114 : bool
115 {
116 return class_exists('Memcached');
117 }

Referenced by getActive().

+ Here is the caller graph for this function:

◆ getInstallationFailureReason()

ilMemcache::getInstallationFailureReason ( )

Reimplemented from ilGlobalCacheService.

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

119 : string
120 {
121 $stats = $this->getMemcacheObject()->getStats();
122 $server_available = false;
123 foreach ($stats as $server) {
124 if ($server['pid'] > 0) {
125 $server_available = true;
126 }
127 }
128 if (!$server_available) {
129 return 'No Memcached-Server available';
130 }
131 return parent::getInstallationFailureReason();
132 }

References $server, and getMemcacheObject().

+ Here is the call graph for this function:

◆ getMemcacheObject()

ilMemcache::getMemcacheObject ( )
protected

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

59 : ?\Memcached
60 {
62 }
static Memcached $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 ( string  $key)

Checks whether the cache key is valid or not.

Reimplemented from ilGlobalCacheService.

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

163 : bool
164 {
165 return true;
166 }

◆ serialize()

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

Reimplemented from ilGlobalCacheService.

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

137 : string
138 {
139 return serialize($value);
140 }

References serialize().

Referenced by serialize().

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

◆ set()

ilMemcache::set ( string  $key,
  $serialized_value,
int  $ttl = null 
)
Parameters
mixed$serialized_value

Reimplemented from ilGlobalCacheService.

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

69 : bool
70 {
71 return $this->getMemcacheObject()
72 ->set($this->returnKey($key), $serialized_value, (int) $ttl);
73 }

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

+ Here is the call graph for this function:

◆ unserialize()

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

Reimplemented from ilGlobalCacheService.

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

147 {
148 return unserialize($serialized_value);
149 }
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

Memcached ilMemcache::$memcache_object = null
staticprotected

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

Referenced by getMemcacheObject().


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