MEMCACHED_FETCH(3)

NAME
memcached_fetch - Retrieving data from the server

SYNOPSIS

#include <libmemcached/memcached.h>
    Compile and link with -lmemcached

char *memcached_fetch(memcached_st <#_CPPv412memcached_st> *ptr, char *key, size_t *key_length, size_t *value_length, uint32_t *flags, memcached_return_t <#_CPPv418memcached_return_t> *error)
    Deprecated since version 0.50: Use memcached_fetch_result() <#_CPPv422memcached_fetch_resultP12memcached_stP19memcached_result_stP18memcached_return_t> instead.

DESCRIPTION

memcached_fetch() is used to fetch an individual value from the server. memcached_mget() <#_CPPv414memcached_mgetP12memcached_stPPCKcPK6size_t6size_t> must always be called before using this method. 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 <#_CPPv418memcached_return_t> pointer to hold any error.

    The object will be returned upon success and NULL will be returned on failure.

    MEMCACHED_END <#_CPPv4N18memcached_return_t13MEMCACHED_ENDE> is returned by the error value when all objects that have been found are returned. The final value upon MEMCACHED_END <#_CPPv4N18memcached_return_t13MEMCACHED_ENDE> is a NULL pointer.

    Values returned by memcached_fetch() must be freed by the caller.

    All of the above functions are not tested when the MEMCACHED_BEHAVIOR_USE_UDP <#_CPPv4N20memcached_behavior_t26MEMCACHED_BEHAVIOR_USE_UDPE> has been set. Executing any of these functions with this behavior on will result in MEMCACHED_NOT_SUPPORTED <#_CPPv4N18memcached_return_t23MEMCACHED_NOT_SUPPORTEDE> being returned, or for those functions which do not return a memcached_return_t <#_CPPv418memcached_return_t>, the error function parameter will be set to MEMCACHED_NOT_SUPPORTED <#_CPPv4N18memcached_return_t23MEMCACHED_NOT_SUPPORTEDE>.

RETURN VALUE

memcached_fetch() sets error to to MEMCACHED_END <#_CPPv4N18memcached_return_t13MEMCACHED_ENDE> upon successful conclusion.

MEMCACHED_NOTFOUND <#_CPPv4N18memcached_return_t18MEMCACHED_NOTFOUNDE> will be return if no keys at all were found.

MEMCACHED_KEY_TOO_BIG <#_CPPv4N18memcached_return_t21MEMCACHED_KEY_TOO_BIGE> is set to error whenever memcached_fetch() was used and the key was set larger then MEMCACHED_MAX_KEY, which was the largest key allowed for the original memcached ascii server.

SEE ALSO

memcached(1) <https://linux.die.net/man/1/memcached> libmemcached(3) <https://linux.die.net/man/3/libmemcached> memcached_strerror(3) <https://linux.die.net/man/3/memcached_strerror> memcached_fetch_result(3) <https://linux.die.net/man/3/memcached_fetch_result>