Memcached
class Memcached (View source)
Constants
OPT_PREFIX_KEY |
Constants taken from http://www.php.net/manual/en/memcached.constants.php |
OPT_COMPRESSION |
|
OPT_HASH |
|
OPT_DISTRIBUTION |
|
OPT_BUFFER_WRITES |
|
OPT_BINARY_PROTOCOL |
|
OPT_NO_BLOCK |
|
OPT_TCP_NODELAY |
|
OPT_SOCKET_SEND_SIZE |
|
OPT_SOCKET_RECV_SIZE |
|
OPT_CONNECT_TIMEOUT |
|
OPT_RETRY_TIMEOUT |
|
OPT_SEND_TIMEOUT |
|
OPT_RECV_TIMEOUT |
|
OPT_POLL_TIMEOUT |
|
OPT_CACHE_LOOKUPS |
|
OPT_SERVER_FAILURE_LIMIT |
|
OPT_SERIALIZER |
|
HAVE_IGBINARY |
|
HAVE_JSON |
|
SERIALIZER_PHP |
|
SERIALIZER_IGBINARY |
|
SERIALIZER_JSON |
|
HASH_DEFAULT |
|
HASH_MD5 |
|
HASH_CRC |
|
HASH_FNV1_64 |
|
HASH_FNV1A_64 |
|
HASH_FNV1_32 |
|
HASH_FNV1A_32 |
|
HASH_HSIEH |
|
HASH_MURMUR |
|
DISTRIBUTION_MODULA |
|
DISTRIBUTION_CONSISTENT |
|
OPT_LIBKETAMA_COMPATIBLE |
|
GET_PRESERVE_ORDER |
|
RES_SUCCESS |
|
RES_FAILURE |
|
RES_HOST_LOOKUP_FAILURE |
|
RES_UNKNOWN_READ_FAILURE |
|
RES_PROTOCOL_ERROR |
|
RES_CLIENT_ERROR |
|
RES_SERVER_ERROR |
|
RES_WRITE_FAILURE |
|
RES_DATA_EXISTS |
|
RES_NOTSTORED |
|
RES_NOTFOUND |
|
RES_PARTIAL_READ |
|
RES_SOME_ERRORS |
|
RES_NO_SERVERS |
|
RES_END |
|
RES_ERRNO |
|
RES_BUFFERED |
|
RES_TIMEOUT |
|
RES_BAD_KEY_PROVIDED |
|
RES_CONNECTION_SOCKET_CREATE_FAILURE |
|
RES_PAYLOAD_FAILURE |
|
Methods
No description
add is similar to set(), but the operation fails if the key already exists on the server.
Memcached::addByKey() is functionally equivalent to Memcached::add(), except that the free-form server_key can be used to map the key to a specific server. This is useful if you need to keep a bunch of related keys on a certain server.
This function is present only for compatibility and does nothing.
This function is present only for compatibility and does nothing.
Memcached::append() appends the given value string to the value of an existing item. The reason that value is forced to be a string is that appending mixed types is not well-defined.
No description
Performs a set and check operation, so that the item will be stored only if no other client has updated it since it was last fetched by this client.
No description
Decrements a numeric item's value by $offset.
No description
deletes the $key from the server.
No description
deletes an array of $keys from the server.
No description
fetch retrieves the next result from the last getDelayed() request.
Fetch all of the remaining results from the last getDelayed() request.
Invalidates all existing cache items immediately.
Returns the item that was previously stored under the $key.
Returns the item and corresponding timestamps that were previously stored under the $key.
This function is present only for compatibility and does nothing.
No description
No description
Issues a request to memcache for multiple items the keys of which are specified in the keys array.
Issues a request to memcache for multiple items with timestamps, the keys of which are specified in the keys array.
No description
No description
Similar to Memcached::get(), but instead of a single key item, it retrieves multiple items the keys of which are specified in the keys array.
Similar to Memcached::peek(), but instead of a single key item, it retrieves multiple items and their timestamps, the keys of which are specified in the keys array.
No description
No description
Retrieve a Memcached option value.
Returns one of the Memcached::RES_* constants that is the result of the last executed Memcached method.
Return the message describing the result of the last operation.
This function is present only for compatibility and does nothing.
This function is present only for compatibility and does nothing.
This function is present only for compatibility and does nothing.
This function is present only for compatibility and does nothing.
Increments a numeric item's value by the specified offset. If the item's value is not numeric, and error will result.
No description
This function is present only for compatibility and does nothing.
This function is present only for compatibility and does nothing.
Prepends the given value string to an existing item.
No description
This function is present only for compatibility and does nothing.
Replace is similar to Memcache::set(), but the operation will fail if the key is not found on the server.
No description
This function is present only for compatibility and does nothing.
Stores the value on a memcache server under the specified key. The expiration parameters can be used to control when the value is considered expired.
No description
Is similar to Memcached::set(), but instead of a single key/value item, it works on multiple items specified in items.
No description
This method sets the vaue of a memcached option.
This is a varion of Memcached::setOption() that takes an array of options to be set.
This function is present only for compatibility and does nothing.
Sets a new expiration time on an item.
Functionally equivalent to Memcached::touch().
Details
at line 119
__construct($persistent_id = null)
at line 138
bool
add(string $key, mixed $value, int $expiration = 0)
add is similar to set(), but the operation fails if the key already exists on the server.
at line 160
bool
addByKey(string $server_key, string $key, mixed $value, int $expiration = 0)
Memcached::addByKey() is functionally equivalent to Memcached::add(), except that the free-form server_key can be used to map the key to a specific server. This is useful if you need to keep a bunch of related keys on a certain server.
at line 170
addServer($host, $port, $weight = 0)
This function is present only for compatibility and does nothing.
at line 177
addServers($servers)
This function is present only for compatibility and does nothing.
at line 191
append(string $key, string $value)
Memcached::append() appends the given value string to the value of an existing item. The reason that value is forced to be a string is that appending mixed types is not well-defined.
at line 215
appendByKey(string $server_key, string $key, string $value)
at line 231
bool
cas(mixed $cas_token, string $key, mixed $value, int $expiration = 0)
Performs a set and check operation, so that the item will be stored only if no other client has updated it since it was last fetched by this client.
at line 281
bool
casByKey(mixed $cas_token, string $server_key, string $key, mixed $value, int $expiration = 0)
at line 300
bool
decrement(string $key, int $offset = 1, int $initial_value = 0, int $expiration = 0)
Decrements a numeric item's value by $offset.
at line 320
bool
decrementByKey(string $server_key, string $key, int $offset = 1, int $initial_value = 0, int $expiration = 0)
at line 338
bool
delete(string $key, int $time = 0)
deletes the $key from the server.
at line 352
bool
deleteByKey(string $server_key, string $key, int $time = 0)
at line 365
bool
deleteMulti(array $keys, int $time = 0)
deletes an array of $keys from the server.
at line 404
bool
deleteMultiByKey(string $server_key, array $keys, int $time = 0)
at line 415
The
fetch()
fetch retrieves the next result from the last getDelayed() request.
Note that currently getDelayed is a synchronous call.
at line 430
array
fetchAll()
Fetch all of the remaining results from the last getDelayed() request.
Note that currently getDelayed is a synchronous call.
at line 447
bool
flush(int $delay = 0)
Invalidates all existing cache items immediately.
at line 463
the
get(string $key, callable $cache_cb = null, mixed $cas_token = null)
Returns the item that was previously stored under the $key.
at line 488
the
peek(string $key, mixed $cas_token = null)
Returns the item and corresponding timestamps that were previously stored under the $key.
at line 576
getAllKeys()
This function is present only for compatibility and does nothing.
at line 591
the
getByKey(string $server_key, string $key, callable $cache_cb, mixed $cas_token)
at line 606
the
peekByKey(string $server_key, string $key, mixed $cas_token)
at line 621
bool
getDelayed(array $keys, bool $with_cas = false, callable $value_cb = null)
Issues a request to memcache for multiple items the keys of which are specified in the keys array.
Currently this method executes synchronously.
at line 639
bool
peekDelayed(array $keys, bool $with_cas = false, callable $value_cb = null)
Issues a request to memcache for multiple items with timestamps, the keys of which are specified in the keys array.
Currently this method executes synchronously.
at line 688
bool
getDelayedByKey(string $server_key, array $keys, bool $with_cas = false, callable $value_cb = null)
at line 705
bool
peekDelayedByKey(string $server_key, array $keys, bool $with_cas = false, callable $value_cb = null)
at line 725
array
getMulti(array $keys, array $cas_tokens = null, int $flags = 0)
Similar to Memcached::get(), but instead of a single key item, it retrieves multiple items the keys of which are specified in the keys array.
at line 753
array
peekMulti(array $keys, array $cas_tokens = null, int $flags = 0)
Similar to Memcached::peek(), but instead of a single key item, it retrieves multiple items and their timestamps, the keys of which are specified in the keys array.
at line 858
array
getMultiByKey($server_key, $keys, $with_cas = false, $value_cb = null)
at line 876
array
peekMultiByKey($server_key, $keys, $with_cas = false, $value_cb = null)
at line 890
mixed
getOption($option)
Retrieve a Memcached option value.
at line 903
int
getResultCode()
Returns one of the Memcached::RES_* constants that is the result of the last executed Memcached method.
at line 912
string
getResultMessage()
Return the message describing the result of the last operation.
at line 930
getServerByKey($server_key)
This function is present only for compatibility and does nothing.
at line 937
getServerList()
This function is present only for compatibility and does nothing.
at line 944
getStats()
This function is present only for compatibility and does nothing.
at line 951
getVersion()
This function is present only for compatibility and does nothing.
at line 966
The
increment(string $key, int $offset = 1, int $initial_value = 0, int $expiry = 0)
Increments a numeric item's value by the specified offset. If the item's value is not numeric, and error will result.
at line 985
The
incrementByKey(string $server_key, string $key, int $offset = 1, int $initial_value = 0, int $expiry = 0)
at line 1043
isPersistent()
This function is present only for compatibility and does nothing.
at line 1050
isPristine()
This function is present only for compatibility and does nothing.
at line 1062
true
prepend(string $key, string $value)
Prepends the given value string to an existing item.
at line 1087
true
prependByKey(string $server_key, string $key, string $value)
at line 1094
quit()
This function is present only for compatibility and does nothing.
at line 1108
true
replace(string $key, mixed $value, int $expiration = 0)
Replace is similar to Memcache::set(), but the operation will fail if the key is not found on the server.
at line 1125
true
replaceByKey(string $server_key, string $key, mixed $value, int $expiration = 0)
at line 1132
resetServerList()
This function is present only for compatibility and does nothing.
at line 1147
true
set(string $key, mixed $value, int $expiration = 0)
Stores the value on a memcache server under the specified key. The expiration parameters can be used to control when the value is considered expired.
at line 1164
true
setByKey(string $server_key, string $key, mixed $value, int $expiration = 0)
at line 1179
setMulti(array $items, int $expiration = 0)
Is similar to Memcached::set(), but instead of a single key/value item, it works on multiple items specified in items.
at line 1218
bool
setMultiByKey(string $server_key, array $items, int $expiration = 0)
at line 1230
bool
setOption(int $option, mixed $value)
This method sets the vaue of a memcached option.
at line 1247
bool
setOptions(mixed $options)
This is a varion of Memcached::setOption() that takes an array of options to be set.
at line 1258
setSaslAuthData($username, $password)
This function is present only for compatibility and does nothing.
at line 1269
bool
touch(string $key, int $expiration = 0)
Sets a new expiration time on an item.
at line 1287
bool
touchByKey(string $server_key, string $key, int $expiration = 0)
Functionally equivalent to Memcached::touch().