ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMemcache Class Reference

Class ilMemcache. More...

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

Public Member Functions

 __construct ($service_id, $component)
 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
 __destruct ()
 getServiceId ()
 setServiceId ($service_id)
 setValid ($key)
 getComponent ()
 setComponent ($component)
 setInvalid ($key=NULL)
 isValid ($key)
 isActive ()
 isInstallable ()
 returnKey ($key)
 setServiceType ($service_type)
 getServiceType ()

Data Fields

const STD_SERVER = '127.0.0.1'
const STD_PORT = 11211

Protected Member Functions

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

Static Protected Attributes

static $servers
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 11 of file class.ilMemcache.php.

Constructor & Destructor Documentation

ilMemcache::__construct (   $service_id,
  $component 
)
Parameters
$service_id
$component

Reimplemented from ilGlobalCacheService.

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

References ilGlobalCacheService\$component, ilGlobalCacheService\$service_id, and getInstallable().

{
if (! (self::$memcache_object instanceof Memcached) AND $this->getInstallable()) {
$memcached = new Memcached();
foreach (self::$servers as $host => $port) {
$memcached->addServer($host, $port);
}
self::$memcache_object = $memcached;
}
}

+ Here is the call graph for this function:

Member Function Documentation

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

Reimplemented from ilGlobalCacheService.

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

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

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

+ Here is the call graph for this function:

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

Reimplemented from ilGlobalCacheService.

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

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

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

+ Here is the call graph for this function:

ilMemcache::flush ( )
Returns
bool

Reimplemented from ilGlobalCacheService.

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

References getMemcacheObject().

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

+ Here is the call graph for this function:

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

Reimplemented from ilGlobalCacheService.

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

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

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

+ Here is the call graph for this function:

ilMemcache::getActive ( )
protected
Returns
bool

Reimplemented from ilGlobalCacheService.

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

References getInstallable(), getMemcacheObject(), and STD_PORT.

{
if ($this->getInstallable()) {
$stats = $this->getMemcacheObject()->getStats();
return $stats[self::STD_SERVER . ':' . self::STD_PORT]['pid'] > 0;
}
}

+ Here is the call graph for this function:

ilMemcache::getInfo ( )
Returns
array

Reimplemented from ilGlobalCacheService.

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

References getMemcacheObject().

{
if (self::isInstallable()) {
$return = array();
$return['__cache_info'] = $this->getMemcacheObject()->getStats();
foreach ($this->getMemcacheObject()->getAllKeys() as $key) {
$return[$key] = $this->getMemcacheObject()->get($key);
}
return $return;
}
}

+ Here is the call graph for this function:

ilMemcache::getInstallable ( )
protected
Returns
bool

Reimplemented from ilGlobalCacheService.

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

Referenced by __construct(), and getActive().

{
return class_exists('Memcached');
}

+ Here is the caller graph for this function:

ilMemcache::getInstallationFailureReason ( )
Returns
string

Reimplemented from ilGlobalCacheService.

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

References getMemcacheObject().

{
if ($this->getMemcacheObject() instanceof Memcached) {
$stats = $this->getMemcacheObject()->getStats();
if (! $stats[self::STD_SERVER . ':' . self::STD_PORT]['pid'] > 0) {
return 'No Memcached-Server available';
}
}
}

+ Here is the call graph for this function:

ilMemcache::getMemcacheObject ( )
protected
Returns
Memcached

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

References $memcache_object.

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

+ Here is the caller graph for this function:

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

Reimplemented from ilGlobalCacheService.

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

{
return serialize($value);
}
ilMemcache::set (   $key,
  $serialized_value,
  $ttl = NULL 
)
Parameters
$key
$serialized_value
null$ttl
Returns
bool

Reimplemented from ilGlobalCacheService.

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

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

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

+ Here is the call graph for this function:

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

Reimplemented from ilGlobalCacheService.

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

{
return unserialize($serialized_value);
}

Field Documentation

ilMemcache::$memcache_object
staticprotected

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

Referenced by getMemcacheObject().

ilMemcache::$servers
staticprotected
Initial value:
array(
self::STD_SERVER => self::STD_PORT,
)

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

const ilMemcache::STD_PORT = 11211

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

Referenced by getActive().

const ilMemcache::STD_SERVER = '127.0.0.1'

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


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