Cache: ezcCacheMemcacheBackend
[ ]
[ ]
[ ]
[ ]
[ ]
Class: ezcCacheMemcacheBackend
|
This backend stores data in a Memcache. [
source]
Parents
ezcCacheMemoryBackend
|
--ezcCacheMemcacheBackend
Constants
Member Variables
|
protected array(string=>int) |
$connectionCounter
= array()
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 string |
$connectionIdentifier
Stores the connection identifier.
This is generated in the ctor and used in the dtor. |
|
protected array(string=>Memcache) |
$connections
= array()
Stores the connections to Memcached. |
|
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 :
Methods
__construct
ezcCacheMemcacheBackend __construct(
[
$options = array()] )
Constructs a new ezcCacheMemcacheBackend object.
Parameters
| Name |
Type |
Description |
$options |
array(string=>mixed) |
|
Throws
| Class | Description |
ezcBaseExtensionNotFoundException |
If the PHP memcache and zlib extensions are not installed. |
ezcCacheMemcacheException |
If the connection to the Memcache host did not succeed. |
__destruct
void __destruct(
)
Destructor for the Memcache backend.
acquireLock
void acquireLock(
string
$key, int
$waitTime, int
$maxTime )
Acquires a lock on the given $key.
Parameters
| Name |
Type |
Description |
$key |
string |
|
$waitTime |
int |
usleep() |
$maxTime |
int |
seconds |
delete
bool delete(
string
$key, [int
$timeout = 0] )
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
fetch
mixed fetch(
mixed
$key )
Returns the data from the cache associated with key $key.
Parameters
| Name |
Type |
Description |
$key |
mixed |
|
Redefinition of
releaseLock
void releaseLock(
string
$key )
Releases a lock on the given $key.
Parameters
| Name |
Type |
Description |
$key |
string |
|
reset
void 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
bool store(
string
$key, mixed
$var, [int
$expire = 0] )
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
Last updated: Mon, 29 Jun 2009