Wrapper for Memcached with local storage support
\Exception |
|
|---|---|
| package | Library |
| subpackage | Cache |
| see | \Memcached\http://pecl.php.net/package/memcached |
| see | \Memcached\http://pecl.php.net/package/igbinary |
| author | Aleksey Korzun |
| version | 0.2 |
| license | MIT |
| link | http://www.webfoundation.net |
| link | http://www.alekseykorzun.com |
__call(string $name, mixed[] $arguments) : mixed
stringmethod that was invoked
mixed[]arguments that were passed to invoked method
mixed__construct(string $pool, array $servers)
stringcreate an instance of cache client with a specfic pool
mixed[]a list of Memcached servers we will be using, each entry in servers is supposed to be an array containing hostname, port, and optionally, weight of the server Example: $servers = array( array('mem1.domain.com', 11211, 33), array('mem2.domain.com', 11211, 67) ); See: http://www.php.net/manual/en/memcached.addservers.php
\Exception |
we want to bail if Memcached extension is not loaded or if passed server list is invalid |
|---|
activate()
deactivate()
delete(string[] | string $keys) : bool
string[]stringarray of keys to delete or a single key
boolreturns false if it failed to delete any of the keysget(string[] | string $keys, mixed $resource, bool $purge) : bool
string[]stringan array of keys or a single key to look-up from cache
mixedwhere to store retrieved resource
boolif you wish to remove key from pool after retrieving resource associated with this you can pass this as true
boolreturns true on a successful request, false on a failure or forced
expirationisActive() : bool
boolreturns true if caching is active otherwise falseisStorageEnabled() : bool
boolreturns true if local storage is enabled false otherwiseisStored(string $key) : bool
string
boolset(string $key, mixed $resource, int $ttl) : bool
stringkey to store passed resource under
mixedresource you want to cache
intwhen should this key expire in seconds
\Exception |
if the key is over 250 bytes |
|---|
boolvalidateServers(array $servers)
mixed[]a list of Memcached servers we will be using
\Exception |
if we detect something out of specification |
|---|
getArray(array $keys) : mixed[] | bool
string[]array of keys to look-up from cache
mixed[]boolreturns array of retrieved resources or false
if look up failsgetSimple(string $key) : mixed | bool
stringkey to look-up from cache
mixedboolreturns cached resource or false on failurestore(string $key, mixed $resource) : mixed
stringkey to save resource under
mixedwhat you are storing in cache
mixedresource that we attempted to storeunwrap(string $key, array $data) : mixed | bool
| see | \Memcached\http://highscalability.com/strategy-break-memcache-dog-pile |
|---|
stringkey that you are retrieving
mixed[]packed data that we got back from cache pool
mixedboolreturns cached resource or false if invalid data was
passed for unwrappingwrap(mixed $resource, int $ttl) : mixed[]
| see | \Memcached\http://highscalability.com/strategy-break-memcache-dog-pile |
|---|
mixedresource that is getting cached
intinternal extended expiration
mixed[]returns packed resource with TTL stamp to store in cache$isActive : bool
$isResourceExpired : bool
$isResourceInvalid : bool
$isStorageEnabled : bool
$memcached : \Memcached
$storage : array
DEFAULT_TTL : int
DELAY : int
EXTENDED_TTL : int