Libmemcached Error Codes
Contents |
libmemcached_success(memcached_return_trc)¶ bool libmemcached_failure(memcached_return_trc)¶ bool libmemcache_continue(memcached_return_trc)¶ memcache error codes bool memcached_success(memcached_return_t)¶ bool memcached_failure(memcached_return_t)¶ memcached_success()
Memcached_server_temporarily_disabled
return true if MEMCACHED_SUCCESS tested true. memcached_failure() return memcached php true if any value other then MEMCACHED_SUCCESS was provided. Libmemcached return types:¶ MEMCACHED_SUCCESS MEMCACHED_FAILURE MEMCACHED_HOST_LOOKUP_FAILURE MEMCACHED_CONNECTION_FAILURE MEMCACHED_CONNECTION_BIND_FAILURE MEMCACHED_WRITE_FAILURE MEMCACHED_READ_FAILURE MEMCACHED_UNKNOWN_READ_FAILURE MEMCACHED_PROTOCOL_ERROR MEMCACHED_CLIENT_ERROR MEMCACHED_SERVER_ERROR MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE MEMCACHED_DATA_EXISTS MEMCACHED_DATA_DOES_NOT_EXIST MEMCACHED_NOTSTORED MEMCACHED_STORED MEMCACHED_NOTFOUND MEMCACHED_MEMORY_ALLOCATION_FAILURE MEMCACHED_PARTIAL_READ MEMCACHED_SOME_ERRORS MEMCACHED_NO_SERVERS MEMCACHED_END MEMCACHED_DELETED MEMCACHED_VALUE MEMCACHED_STAT MEMCACHED_ITEM MEMCACHED_ERRNO MEMCACHED_FAIL_UNIX_SOCKET MEMCACHED_NOT_SUPPORTED MEMCACHED_NO_KEY_PROVIDED MEMCACHED_FETCH_NOTFINISHED MEMCACHED_TIMEOUT MEMCACHED_BUFFERED MEMCACHED_BAD_KEY_PROVIDED MEMCACHED_INVALID_HOST_PROTOCOL MEMCACHED_SERVER_MARKED_DEAD MEMCACHED_UNKNOWN_STAT_KEY MEMCACHED_E2BIG MEMCACHED_INVALID_ARGUMENTS MEMCACHED_KEY_TOO_BIG MEMCACHED_AUTH_PROBLEM MEMCACHED_AUTH_FAILURE MEMCACHED_AUTH_CONTINUE MEMCACHED_PARSE_ERROR MEMCACHED_PARSE_USER_ERROR MEMCACHED_DEPRECATED SEE ALSO¶ memcached libmemcached memcached_client_error or memcached_worker_error Table Of Contents Error Codes (memcached_return_t) SYNOPSIS Libmemcached return types: SEE ALSO Previous topic Disconnecting a client from a server Next topic SASL support Quick search Enter search terms or a module, class or function name. Navigation index next | previous | libmemcached 1.1.0 documentation &r
char * memcached_get(memcached_st*ptr, const char*key, size_tkey_length, size_t*value_length, uint32_t*flags, memcached_return_t*error)¶ memcached_return_t memcached_mget(memcached_st*ptr, const char * const*keys, const size_t*key_length, size_tnumber_of_keys)¶ char * memcached_get_by_key(memcached_st*ptr, const char*group_key, size_tgroup_key_length, const char*key, size_tkey_length, size_t*value_length, uint32_t*flags, memcached_return_t*error)¶ memcached_return_t memcached_mget_by_key(memcached_st*ptr, const char*group_key, size_tgroup_key_length, const char * const*keys, http://docs.libmemcached.org/libmemcached/memcached_return_t.html const size_t*key_length, size_tnumber_of_keys)¶ memcached_return_t memcached_fetch_execute(memcached_st*ptr, memcached_execute_fn*callback, void*context, uint32_tnumber_of_callbacks)¶ memcached_return_t memcached_mget_execute(memcached_st*ptr, const char * const*keys, const size_t*key_length, size_tnumber_of_keys, memcached_execute_fn*callback, void*context, uint32_tnumber_of_callbacks)¶ memcached_return_t memcached_mget_execute_by_key(memcached_st*ptr, const char*group_key, size_tgroup_key_length, const char * const*keys, const size_t*key_length, http://docs.libmemcached.org/memcached_get.html size_tnumber_of_keys, memcached_execute_fn*callback, void*context, uint32_tnumber_of_callbacks)¶ memcached_return_t (*memcached_execute_fn)(const memcached_st*ptr, memcached_result_st*result, void*context)¶ Compile and link with -lmemcached DESCRIPTION¶ memcached_get() is used to fetch an individual value from the server. You must pass in a key and its length to fetch the object. You must supply three pointer variables which will give you the state of the returned object. A uint32_t pointer to contain whatever flags you stored with the value, a size_t pointer which will be filled with size of of the object, and a memcached_return_t pointer to hold any error. The obj
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss http://stackoverflow.com/questions/9042883/php-memcached-extension-result-codes the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack http://sendapatch.se/projects/pylibmc/misc.html Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping error codes each other. Join them; it only takes a minute: Sign up PHP Memcached extension result codes up vote 7 down vote favorite 4 I'm using the Memcached::set() and Memcached::get() methods. The documentation states that if an error occurs, or, in general, to check the status of these methods, I should call Memcached::getResultCode(). Where can I find a complete libmemcached error codes list of result codes, with both what the result code represents and what its numeric values is? The best thing I found so far is in some comments from Memcached::getResultCode(), but the list doesn't include 8 and 47. Another list is in the Memcached Predefined Constants page, but it doesn't include the numeric values. php memcached share|improve this question asked Jan 28 '12 at 4:21 rid 30.4k1289144 add a comment| 1 Answer 1 active oldest votes up vote 13 down vote accepted I found the error codes in the libmemcached source code. 0 = MEMCACHED_SUCCESS 1 = MEMCACHED_FAILURE 2 = MEMCACHED_HOST_LOOKUP_FAILURE // getaddrinfo() and getnameinfo() only 3 = MEMCACHED_CONNECTION_FAILURE 4 = MEMCACHED_CONNECTION_BIND_FAILURE // DEPRECATED see MEMCACHED_HOST_LOOKUP_FAILURE 5 = MEMCACHED_WRITE_FAILURE 6 = MEMCACHED_READ_FAILURE 7 = MEMCACHED_UNKNOWN_READ_FAILURE 8 = MEMCACHED_PROTOCOL_ERROR 9 = MEMCACHED_CLIENT_ERROR 10 = MEMCACHED_SERVER_ERROR // Server returns "SERVER_ERROR" 11 = MEMCACHED_ERROR // Server returns "ERROR" 11 = MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE = MEMCACHED_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_R
on their heads (duh). Also, the average elevator travels 10,000 miles per year and Thomas Edison was afraid of the dark. Differences from python-memcached¶ In general, because pylibmc is built on top of libmemcached, it issues exceptions for a lot of errors which python-memcached doesn't. One example is if a memcached goes down, libmemcached will report an error whereas python-memcached will simply cycle to the next memcached. On a similar note, pylibmc won't raise a ValueError if one uses Client.inc on a non-existent key, instead a pylibmc.NotFound exception is raised. Negative timeouts are treated the same way as zero timeouts are in pylibmc. python-memcached treats this as immediate expiry, returning success while not setting any value. This might raise exceptions in the future. The most notable difference is the hashing. See the hashing docs for information and how to resolve the issue. When setting huge key values, i.e. around 1MB, will have pylibmc complain loudly whereas python-memcached simply ignores the error and returns. pylibmc.Client is not threadsafe like python-memcached's Client class (which is threadlocal). Exceptions¶ Most of all libmemcached error numbers are translated to exception classes except where it doesn't make sense. All pylibmc exceptions derive from pylibmc.Error, so to attempt a memcached operation and never fail, something like this could be used (although it should be noted soft errors are handled via return values; errors aren't always exceptional when caching things): try: op() except pylibmc.Error as e: log_exc() Should you for some reason need the actual error code returned from libmemcached, simply sneak a peak at the retcode attribute. If you're interested in exactly what maps to what, see _pylibmcmodule.h. Warning Never ignore exceptional states. Any programmer worth his salt knows that an except block must handle the error, or make the error obvious to administrators (use logs, people!) Compression¶ libmemcached has no built-in support for compression, and so to be compatible with python-memcached, pylibmc implements it by itself. Compression requires zlib to be available when