Memcached::getResultCode
(PECL memcached >= 0.1.0)
Memcached::getResultCode — Return the result code of the last operation
Описание
public int Memcached::getResultCode
( void
)
Memcached::getResultCode() returns one of the
Memcached::RES_*
constants that is the result of the
last executed Memcached method.
Список параметров
У этой функции нет параметров.
Возвращаемые значения
Result code of the last Memcached operation.
Примеры
Пример #1 Memcached::getResultCode() example
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
$m->add('foo', 'bar');
if ($m->getResultCode() == Memcached::RES_NOTSTORED) {
/* ... */
}
?>
- Функция Memcached::add() - Add an item under a new key
- Функция Memcached::addByKey() - Add an item under a new key on a specific server
- Функция Memcached::addServer() - Add a server to the server pool
- Функция Memcached::addServers() - Add multiple servers to the server pool
- Функция Memcached::append() - Append data to an existing item
- Функция Memcached::appendByKey() - Append data to an existing item on a specific server
- Функция Memcached::cas() - Compare and swap an item
- Функция Memcached::casByKey() - Compare and swap an item on a specific server
- Функция Memcached::__construct() - Create a Memcached instance
- Функция Memcached::decrement() - Decrement numeric item's value
- Функция Memcached::decrementByKey() - Decrement numeric item's value, stored on a specific server
- Функция Memcached::delete() - Delete an item
- Функция Memcached::deleteByKey() - Delete an item from a specific server
- Функция Memcached::deleteMulti() - Delete multiple items
- Функция Memcached::deleteMultiByKey() - Delete multiple items from a specific server
- Функция Memcached::fetch() - Fetch the next result
- Функция Memcached::fetchAll() - Fetch all the remaining results
- Функция Memcached::flush() - Invalidate all items in the cache
- Функция Memcached::get() - Retrieve an item
- Функция Memcached::getAllKeys() - Gets the keys stored on all the servers
- Функция Memcached::getByKey() - Retrieve an item from a specific server
- Функция Memcached::getDelayed() - Request multiple items
- Функция Memcached::getDelayedByKey() - Request multiple items from a specific server
- Функция Memcached::getMulti() - Retrieve multiple items
- Функция Memcached::getMultiByKey() - Retrieve multiple items from a specific server
- Функция Memcached::getOption() - Retrieve a Memcached option value
- Функция Memcached::getResultCode() - Return the result code of the last operation
- Функция Memcached::getResultMessage() - Return the message describing the result of the last operation
- Функция Memcached::getServerByKey() - Map a key to a server
- Функция Memcached::getServerList() - Get the list of the servers in the pool
- Функция Memcached::getStats() - Get server pool statistics
- Функция Memcached::getVersion() - Get server pool version info
- Функция Memcached::increment() - Increment numeric item's value
- Функция Memcached::incrementByKey() - Increment numeric item's value, stored on a specific server
- Функция Memcached::isPersistent() - Check if a persitent connection to memcache is being used
- Функция Memcached::isPristine() - Check if the instance was recently created
- Функция Memcached::prepend() - Prepend data to an existing item
- Функция Memcached::prependByKey() - Prepend data to an existing item on a specific server
- Функция Memcached::quit() - Close any open connections
- Функция Memcached::replace() - Replace the item under an existing key
- Функция Memcached::replaceByKey() - Replace the item under an existing key on a specific server
- Функция Memcached::resetServerList() - Clears all servers from the server list
- Функция Memcached::set() - Store an item
- Функция Memcached::setByKey() - Store an item on a specific server
- Функция Memcached::setMulti() - Store multiple items
- Функция Memcached::setMultiByKey() - Store multiple items on a specific server
- Функция Memcached::setOption() - Set a Memcached option
- Функция Memcached::setOptions() - Set Memcached options
- Функция Memcached::setSaslAuthData() - Set the credentials to use for authentication
- Функция Memcached::touch() - Set a new expiration on an item
- Функция Memcached::touchByKey() - Set a new expiration on an item on a specific server
Коментарии
A more up to date and correct list of the result codes (Note that ERR_NO maps to 26 not 25 as stated above):
Memcached::OPT_COMPRESSION - -1001
Memcached::OPT_SERIALIZER - -1003
Memcached::SERIALIZER_PHP - 1
Memcached::SERIALIZER_IGBINARY - 2
Memcached::SERIALIZER_JSON - 3
Memcached::OPT_PREFIX_KEY - -1002
Memcached::OPT_HASH - 2
Memcached::HASH_DEFAULT - 0
Memcached::HASH_MD5 - 1
Memcached::HASH_CRC - 2
Memcached::HASH_FNV1_64 - 3
Memcached::HASH_FNV1A_64 - 4
Memcached::HASH_FNV1_32 - 5
Memcached::HASH_FNV1A_32 - 6
Memcached::HASH_HSIEH - 7
Memcached::HASH_MURMUR - 8
Memcached::OPT_DISTRIBUTION - 9
Memcached::DISTRIBUTION_MODULA - 0
Memcached::DISTRIBUTION_CONSISTENT - 1
Memcached::OPT_LIBKETAMA_COMPATIBLE - 16
Memcached::OPT_BUFFER_WRITES - 10
Memcached::OPT_BINARY_PROTOCOL - 18
Memcached::OPT_NO_BLOCK - 0
Memcached::OPT_TCP_NODELAY - 1
Memcached::OPT_SOCKET_SEND_SIZE - 4
Memcached::OPT_SOCKET_RECV_SIZE - 5
Memcached::OPT_CONNECT_TIMEOUT - 14
Memcached::OPT_RETRY_TIMEOUT - 15
Memcached::OPT_SEND_TIMEOUT - 19
Memcached::OPT_RECV_TIMEOUT - 15
Memcached::OPT_POLL_TIMEOUT - 8
Memcached::OPT_CACHE_LOOKUPS - 6
Memcached::OPT_SERVER_FAILURE_LIMIT - 21
Memcached::HAVE_IGBINARY - #&UNDEFINED;#
Memcached::HAVE_JSON - #&UNDEFINED;#
Memcached::GET_PRESERVE_ORDER - 1
Memcached::RES_SUCCESS - 0
Memcached::RES_FAILURE - 1
Memcached::RES_HOST_LOOKUP_FAILURE - 2
Memcached::RES_UNKNOWN_READ_FAILURE - 7
Memcached::RES_PROTOCOL_ERROR - 8
Memcached::RES_CLIENT_ERROR - 9
Memcached::RES_SERVER_ERROR - 10
Memcached::RES_WRITE_FAILURE - 5
Memcached::RES_DATA_EXISTS - 12
Memcached::RES_NOTSTORED - 14
Memcached::RES_NOTFOUND - 16
Memcached::RES_PARTIAL_READ - 18
Memcached::RES_SOME_ERRORS - 19
Memcached::RES_NO_SERVERS - 20
Memcached::RES_END - 21
Memcached::RES_ERRNO - 26
Memcached::RES_BUFFERED - 32
Memcached::RES_TIMEOUT - 31
Memcached::RES_BAD_KEY_PROVIDED - 33
Memcached::RES_CONNECTION_SOCKET_CREATE_FAILURE - 11
Memcached::RES_PAYLOAD_FAILURE - -1001
00 = MEMCACHED_SUCCESS
01 = MEMCACHED_FAILURE
02 = MEMCACHED_HOST_LOOKUP_FAILURE // getaddrinfo() and getnameinfo() only
03 = MEMCACHED_CONNECTION_FAILURE
04 = MEMCACHED_CONNECTION_BIND_FAILURE // DEPRECATED see MEMCACHED_HOST_LOOKUP_FAILURE
05 = MEMCACHED_WRITE_FAILURE
06 = MEMCACHED_READ_FAILURE
07 = MEMCACHED_UNKNOWN_READ_FAILURE
08 = MEMCACHED_PROTOCOL_ERROR
09 = MEMCACHED_CLIENT_ERROR
10 = MEMCACHED_SERVER_ERROR // Server returns "SERVER_ERROR"
11 = MEMCACHED_ERROR // Server returns "ERROR"
12 = MEMCACHED_DATA_EXISTS
13 = MEMCACHED_DATA_DOES_NOT_EXIST
14 = MEMCACHED_NOTSTORED
15 = MEMCACHED_STORED
16 = MEMCACHED_NOTFOUND
17 = MEMCACHED_MEMORY_ALLOCATION_FAILURE
18 = MEMCACHED_PARTIAL_READ
19 = MEMCACHED_SOME_ERRORS
20 = MEMCACHED_NO_SERVERS
21 = MEMCACHED_END
22 = MEMCACHED_DELETED
23 = MEMCACHED_VALUE
24 = MEMCACHED_STAT
25 = MEMCACHED_ITEM
26 = MEMCACHED_ERRNO
27 = MEMCACHED_FAIL_UNIX_SOCKET // DEPRECATED
28 = MEMCACHED_NOT_SUPPORTED
29 = MEMCACHED_NO_KEY_PROVIDED /* Deprecated. Use MEMCACHED_BAD_KEY_PROVIDED! */
30 = MEMCACHED_FETCH_NOTFINISHED
31 = MEMCACHED_TIMEOUT
32 = MEMCACHED_BUFFERED
33 = MEMCACHED_BAD_KEY_PROVIDED
34 = MEMCACHED_INVALID_HOST_PROTOCOL
35 = MEMCACHED_SERVER_MARKED_DEAD
36 = MEMCACHED_UNKNOWN_STAT_KEY
37 = MEMCACHED_E2BIG
38 = MEMCACHED_INVALID_ARGUMENTS
39 = MEMCACHED_KEY_TOO_BIG
40 = MEMCACHED_AUTH_PROBLEM
41 = MEMCACHED_AUTH_FAILURE
42 = MEMCACHED_AUTH_CONTINUE
43 = MEMCACHED_PARSE_ERROR
44 = MEMCACHED_PARSE_USER_ERROR
45 = MEMCACHED_DEPRECATED
46 = MEMCACHED_IN_PROGRESS
47 = MEMCACHED_SERVER_TEMPORARILY_DISABLED
48 = MEMCACHED_SERVER_MEMORY_ALLOCATION_FAILURE
49 = MEMCACHED_MAXIMUM_RETURN /* Always add new error code before */
11 = MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE = MEMCACHED_ERROR