Zeta Components Manual :: Docs For Class ezcCacheMemcacheBackend
Cache::ezcCacheMemcacheBackend
Class ezcCacheMemcacheBackend
This backend stores data in a Memcache.
Source for this file: /Cache/src/backends/memcache/memcache_backend.php
ezcCacheMemoryBackend | --ezcCacheMemcacheBackend
Version: | //autogentag// |
Constants
COMPRESS_THRESHOLD
= 1000000
|
The compress threshold. Nearly 1MB (48,576B less). |
MAX_KEY_LENGTH
= 249
|
Maximum length of a cache key for Memcached. |
Member Variables
protected static array(string=>int) |
$connectionCounter
Keeps track of the number of backends using the same connection. This is to avoid that the dtor of a backend accedentally closes a connection that is still in used by another backend. |
protected static array(string=>Memcache) |
$connections
Stores the connections to Memcached. |
protected string |
$connectionIdentifier
Stores the connection identifier. This is generated in the ctor and used in the dtor. |
protected resource |
$memcache
Holds an instance to a Memcache object. |
protected ezcCacheStorageMemcacheOptions |
$options
Holds the options for this class. |
Method Summary
public ezcCacheMemcacheBackend |
__construct(
[ $options
= array()] )
Constructs a new ezcCacheMemcacheBackend object. |
public void |
__destruct(
)
Destructor for the Memcache backend. |
public void |
acquireLock(
$key
, $waitTime
, $maxTime
)
Acquires a lock on the given $key. |
public bool |
delete(
$key
, [ $timeout
= 0] )
Deletes the data from the cache associated with key $key. Returns true or false depending on the success of the operation. |
public mixed |
fetch(
$key
)
Returns the data from the cache associated with key $key. |
public void |
releaseLock(
$key
)
Releases a lock on the given $key. |
public void |
reset(
)
Resets the complete backend. |
public bool |
store(
$key
, $var
, [ $expire
= 0] )
Adds the $var data to the cache under the key $key. Returns true or false depending on the success of the operation. |
Inherited Methods
From ezcCacheMemoryBackend | |
---|---|
public abstract bool |
ezcCacheMemoryBackend::delete()
Deletes the data associated with key $key. |
public abstract mixed |
ezcCacheMemoryBackend::fetch()
Fetches the data associated with key $key. |
public abstract bool |
ezcCacheMemoryBackend::store()
Stores the data $var under the key $key. |
Methods
__construct
Constructs a new ezcCacheMemcacheBackend object.
For options for this backend see ezcCacheStorageMemcacheOptions.
Parameters:
Name | Type | Description |
---|---|---|
$options |
array(string=>mixed) |
Exceptions:
Type | Description |
---|---|
ezcCacheMemcacheException |
If the connection to the Memcache host did not succeed. |
ezcBaseExtensionNotFoundException |
If the PHP memcache and zlib extensions are not installed. |
__destruct
Destructor for the Memcache backend.
acquireLock
Acquires a lock on the given $key.
Parameters:
Name | Type | Description |
---|---|---|
$key |
string | |
$waitTime |
int | usleep() |
$maxTime |
int | seconds |
delete
Deletes the data from the cache associated with key $key. Returns true or false depending on the success of the operation.
The value $timeout specifies the timeout period in seconds for the delete command.
Parameters:
Name | Type | Description |
---|---|---|
$key |
string | |
$timeout |
int |
Redefinition of:
Method | Description |
---|---|
ezcCacheMemoryBackend::delete() |
Deletes the data associated with key $key. |
fetch
Returns the data from the cache associated with key $key.
Parameters:
Name | Type | Description |
---|---|---|
$key |
mixed |
Redefinition of:
Method | Description |
---|---|
ezcCacheMemoryBackend::fetch() |
Fetches the data associated with key $key. |
releaseLock
Releases a lock on the given $key.
Parameters:
Name | Type | Description |
---|---|---|
$key |
string |
reset
Resets the complete backend.
Marked private to not expose more of this interface to the user, since this will be removed in future versions.
store
Adds the $var data to the cache under the key $key. Returns true or false depending on the success of the operation.
Parameters:
Name | Type | Description |
---|---|---|
$key |
string | |
$var |
mixed | |
$expire |
int |
Redefinition of:
Method | Description |
---|---|
ezcCacheMemoryBackend::store() |
Stores the data $var under the key $key. |