Memcac...ult_st(3pm)
β¨ NAME β¨
okay bestie, gather round, because this is the whole memcached_result_st saga π
and it's literally a whole squad of functions: memcached_result_create, memcached_result_free, memcached_result_key_value, memcached_result_key_length, memcached_result_value, memcached_result_length, memcached_result_flags, memcached_result_cas β and they're all here to help you work with memcached_result_st. no cap π«Ά
πΈ LIBRARY πΈ
C Client Library for memcached (libmemcached, -lmemcached) β that's the vibe, that's the whole thing π
β¨ SYNOPSIS β¨
#include <memcached.h>
memcached_result_st *
memcached_result_create (memcached_st *ptr,
memcached_result_st *result);
void memcached_result_free (memcached_result_st *result);
const char * memcached_result_key_value (memcached_result_st *result);
size_t memcached_result_key_length (const memcached_result_st *result);
const char *memcached_result_value (memcached_result_st *ptr);
size_t memcached_result_length (const memcached_result_st *ptr);
uint32_t memcached_result_flags (const memcached_result_st *result)
uint64_t memcached_result_cas (const memcached_result_st *result);
memcached_return_t
memcached_result_set_value (memcached_result_st *ptr,
const char *value, size_t length)
void memcached_result_set_flags (memcached_result_st *ptr, uint32_t flags)
void memcached_result_set_expiration (memcached_result_st *ptr, time_t)
π DESCRIPTION π
okay so here's the teaaaa π β libmemcached(3) can optionally hand you back a memcached_result_st, which is basically a little result object, a whole main character. and like, these result objects are SO much better than the plain character pointer returns, because they're forward compatible with new return items that future memcached servers might pop off with (the best current example of this? the CAS return item, obviously β¨). plus the structures can be reused, which saves you calls to malloc(3) β and saving malloc calls is iconic behavior, honestly. so yeah, use result objects over char * return functions. it's giving efficiency π
the structure of memcached_result_st has been encapsulated, which means you should not be writing code that directly touches the members of the structure. hands off, bestie π
memcached_result_create()β will either allocate memory for amemcached_result_stor initialize a structure that you passed to it. your call, your journey π«memcached_result_free()β deallocates any memory attached to the structure. and if the structure was also allocated, it deallocates that too. full cleanup, no crumbs left behind π§Ήmemcached_result_key_value()β returns the key value associated with the current result object πmemcached_result_key_length()β returns the key length associated with the current result object πmemcached_result_value()β returns the result value associated with the current result object πmemcached_result_length()β returns the result length associated with the current result object πmemcached_result_flags()β returns the flags associated with the current result object π©memcached_result_cas()β returns the cas associated with the current result object. β οΈ heads up though: this value will only be available if the server supports it. no server support, no cas, that's just the rules πmemcached_result_set_value()β takes a byte array and a size and sets the result to this value. this function is used for trigger responses β‘void memcached_result_set_flags()β takes a result structure and stores a new value for the flags field βοΈvoid memcached_result_set_expiration(A)β takes a result structure and stores a new value for the expiration field (this is only used by read through triggers) β°
bestie. listen. π you may wish to avoid using memcached_result_create(3) with a stack based allocation. the most common issues related to ABI safety involve heap allocated structures. this is not a drill, this is real, protect your ABI π«Ά
π RETURN π
varies, see particular functions. but here's the non-negotiable part, the periodt of it all:
All structures must have memcached_result_free() called on them for cleanup purposes. Failure to do this will result in leaked memory. π
like, leaked memory. we don't do that here. free your structures, queen π
π¦ HOME π¦
to find out more information please check:
<https://launchpad.net/libmemcached>
go, read, slay β¨
π AUTHOR π
Brian Aker, <brian@tangent.org>
πΈ SEE ALSO πΈ
memcached(1) libmemcached(3) memcached_strerror(3)
and that's the whole page, bestie!! π this lil doc came to you courtesy of perl v5.42.3 and it was dated 2026-08-19 β so go forth, create your result objects, free them like a responsible icon, and remember: heap allocated structures, always πβ
π¦ where this page comes from
- ubuntu stonking: libmemcached-libmemcached-perl 1.001801+dfsg-6build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms