Elgg  Version 2.3
Public Member Functions | List of all members
ElggMemcache Class Reference

Memcache wrapper class. More...

Inheritance diagram for ElggMemcache:
ElggSharedMemoryCache ElggCache

Public Member Functions

 __construct ($namespace= 'default',\Stash\Pool $pool=null, $ttl=null)
 Constructor. More...
 
 setDefaultExpiry ($ttl=0)
 Set the default TTL. More...
 
 save ($key, $data, $ttl=null)
 Saves a name and value to the cache. More...
 
 load ($key, $unused1=0, $unused2=null)
 Retrieves data. More...
 
 delete ($key)
 Delete data. More...
 
 clear ()
 Clears all values in the namespace of this cache. More...
 
 setNamespace ($namespace="default")
 Set the namespace of this cache. More...
 
- Public Member Functions inherited from ElggSharedMemoryCache
 setNamespace ($namespace="default")
 Set the namespace of this cache. More...
 
 getNamespace ()
 Get the namespace currently defined. More...
 
- Public Member Functions inherited from ElggCache
 __construct ()
 Set the constructor. More...
 
 setVariable ($variable, $value)
 Set a cache variable. More...
 
 getVariable ($variable)
 Get variables for this cache. More...
 
 __get ($key)
 Class member get overloading, returning key using $this->load defaults. More...
 
 __set ($key, $value)
 Class member set overloading, setting a key using $this->save defaults. More...
 
 __isset ($key)
 Supporting isset, using $this->load() with default values. More...
 
 __unset ($key)
 Supporting unsetting of magic attributes. More...
 
 save ($key, $data)
 Save data in a cache. More...
 
 load ($key, $offset=0, $limit=null)
 Load data from the cache using a given key. More...
 
 delete ($key)
 Invalidate a key. More...
 
 clear ()
 Clear out all the contents of the cache. More...
 
 add ($key, $data)
 Add a key only if it doesn't already exist. More...
 
 offsetSet ($key, $value)
 Assigns a value for the specified key. More...
 
 offsetGet ($key)
 Get the value for specified key. More...
 
 offsetUnset ($key)
 Unsets a key. More...
 
 offsetExists ($key)
 Does key exist. More...
 

Detailed Description

Memcache wrapper class.

Definition at line 6 of file ElggMemcache.php.

Constructor & Destructor Documentation

ElggMemcache::__construct (   $namespace = 'default',
\Stash\Pool  $pool = null,
  $ttl = null 
)

Constructor.

Parameters
string$namespaceThe namespace for this cache to write to
\Stash\Pool$poolThe cache pool to use. Default is memcache.
int$ttlThe TTL in seconds. Default is from $CONFIG->memcache_expires.
Exceptions
ConfigurationException
See also
_elgg_get_memcache() Core developers should use this instead of direct construction.

Definition at line 29 of file ElggMemcache.php.

Member Function Documentation

ElggMemcache::clear ( )

Clears all values in the namespace of this cache.

Returns
bool

Definition at line 153 of file ElggMemcache.php.

ElggMemcache::delete (   $key)

Delete data.

Parameters
string$keyName of data
Returns
bool

Definition at line 143 of file ElggMemcache.php.

ElggMemcache::load (   $key,
  $unused1 = 0,
  $unused2 = null 
)

Retrieves data.

Parameters
string$keyName of data to retrieve
int$unused1Unused
int$unused2Unused
Returns
mixed

Definition at line 118 of file ElggMemcache.php.

ElggMemcache::save (   $key,
  $data,
  $ttl = null 
)

Saves a name and value to the cache.

Parameters
string$keyName
string$dataValue
integer$ttlTTL of cache item (seconds), 0 for no expiration, null for default.
Returns
bool

Definition at line 87 of file ElggMemcache.php.

ElggMemcache::setDefaultExpiry (   $ttl = 0)

Set the default TTL.

Parameters
int$ttlThe TTL in seconds from now. Default is no expiration.
Returns
void

Definition at line 60 of file ElggMemcache.php.

ElggMemcache::setNamespace (   $namespace = "default")

Set the namespace of this cache.

This will also add the Memcache namespace prefix as defined in settings.php

Parameters
string$namespaceNamespace for cache
Returns
void

Definition at line 168 of file ElggMemcache.php.


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