PHP Class ElggMemcache, Elgg

Inheritance: extends ElggSharedMemoryCache
Mostra file Open project: elgg/elgg Class Usage Examples

Public Methods

Method Description
__construct ( string $namespace = 'default', Pool $pool = null, integer $ttl = null ) Constructor
clear ( ) : boolean Clears all values in the namespace of this cache
delete ( string $key ) : boolean Delete data
load ( string $key, integer $unused1, integer $unused2 = null ) : mixed Retrieves data.
save ( string $key, string $data, integer $ttl = null ) : boolean Saves a name and value to the cache
setDefaultExpiry ( integer $ttl ) : void Set the default TTL.
setNamespace ( string $namespace = "default" ) : void Set the namespace of this cache.

Private Methods

Method Description
makeMemcacheKey ( string $key ) : string Combine a key with the namespace.

Method Details

__construct() public method

Constructor
See also: _elgg_get_memcache() Core developers should use this instead of direct construction.
public __construct ( string $namespace = 'default', Pool $pool = null, integer $ttl = null )
$namespace string The namespace for this cache to write to
$pool Stash\Pool The cache pool to use. Default is memcache.
$ttl integer The TTL in seconds. Default is from $CONFIG->memcache_expires.

clear() public method

Clears all values in the namespace of this cache
public clear ( ) : boolean
return boolean

delete() public method

Delete data
public delete ( string $key ) : boolean
$key string Name of data
return boolean

load() public method

Retrieves data.
public load ( string $key, integer $unused1, integer $unused2 = null ) : mixed
$key string Name of data to retrieve
$unused1 integer Unused
$unused2 integer Unused
return mixed

save() public method

Saves a name and value to the cache
public save ( string $key, string $data, integer $ttl = null ) : boolean
$key string Name
$data string Value
$ttl integer TTL of cache item (seconds), 0 for no expiration, null for default.
return boolean

setDefaultExpiry() public method

Set the default TTL.
public setDefaultExpiry ( integer $ttl ) : void
$ttl integer The TTL in seconds from now. Default is no expiration.
return void

setNamespace() public method

This will also add the Memcache namespace prefix as defined in settings.php
public setNamespace ( string $namespace = "default" ) : void
$namespace string Namespace for cache
return void