MEMCACHED_FETCH(3)
π NAME π
memcached_fetch β bestie, this is how you retrieve data from the server β¨ it's the libmemcached-awesome manual page MEMCACHED_FETCH(3), and we're gonna get you fed π
πΈ SYNOPSIS πΈ
okay so first things first, you gotta pull in the header and link the lib:
#include <libmemcached/memcached.h>
Compile and link with -lmemcached
and here's the function itself, look at her π
char *memcached_fetch(memcached_st *ptr, char *key, size_t *key_length,
size_t *value_length, uint32_t *flags, memcached_return_t *error)
lowkey tragic news: she's Deprecated since version 0.50 π use memcached_fetch_result() instead, bestie. periodt.
π¦ DESCRIPTION π¦
so memcached_fetch() grabs an individual value off the server. one. single. value. main character energy, no sharing.
β οΈ important!! you must always callmemcached_mget()before you use this method. like, always always. nomemcached_mget(), no service π
and you must pass in a key and its length to fetch the object. that's the entry fee.
then you gotta hand over three pointer variables so the function can spill the tea on the returned object's state:
- a
uint32_tpointer to contain whatever flags you stored with the value π - a
size_tpointer which will be filled with size of of the object π (yes that's verbatim, she's quirky like that) - a
memcached_return_tpointer to hold any error π
the object will be returned upon success and NULL will be returned on failure. it's giving all-or-nothing.
MEMCACHED_END is returned by the error value when all objects that have been found are returned. and the final value upon MEMCACHED_END is a NULL pointer. so when you see that NULL, that's your cue that the party's over β¨
πΈ bestie do NOT forget: values returned by memcached_fetch() must be freed by the caller. that's your mess to clean up, not hers.
π§ a lil sidebar on UDP
all of the above functions are not tested when MEMCACHED_BEHAVIOR_USE_UDP has been set π¬ so if you run any of these with that behavior on, you'll get MEMCACHED_NOT_SUPPORTED back β or, for those functions which do not return a memcached_return_t, the error function parameter will be set to MEMCACHED_NOT_SUPPORTED. either way: not supported, no cap π
β RETURN VALUE β
memcached_fetch()sets error to toMEMCACHED_ENDupon successful conclusion π (yes, "to to", we love her)MEMCACHED_NOTFOUNDwill be return if no keys at all were found π (and yes, "will be return", iconic)MEMCACHED_KEY_TOO_BIGis set to error whenevermemcached_fetch()was used and the key was set larger thenMEMCACHED_MAX_KEYβ which was the largest key allowed for the original memcached ascii server π«π
π SEE ALSO π
and that's the whole page, bestie!! π«Ά this was libmemcached-awesome, version 1.1, dated Jul 24, 2025 β go forth and fetch responsibly, mwah π
πβ¨
π¦ where this page comes from
- fedora 43: libmemcached-awesome-devel 1.1.4-7.fc43 Β· BSD-3-Clause
- fedora 43: libmemcached-awesome-devel 1.1.4-7.fc43 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms