MEMCACHED_DUMP(3)

πŸ’– MEMCACHED_DUMP πŸ’–

okay bestie so we're cracking open memcached_dump(3) from the libmemcached-awesome manual, and it's literally the libmemcached documentation, no cap. sit down, grab a strawberry, we're doing this πŸ“


✨ NAME ✨

memcached_dump β€” libmemcached Documentation πŸ‘‘


🌸 SYNOPSIS 🌸

first things first, you gotta pull the header in and link the lib:

#include <libmemcached/memcached.h>

and compile + link with -lmemcached πŸŽ€

then here's the callback type you're signing up for:

typedef memcached_return_t (*memcached_dump_fn)(memcached_st *ptr, const char *key, size_t key_length, void *context)

she takes four params and i need you to know each one fr:

  • Param ptr β€” pointer to memcached_st object
  • Param key β€” the key string being dumped
  • Param key_length β€” length of the key, and no terminating zero included, don't play yourself
  • Param context β€” pointer to the user supplied context
  • Returns β€” memcached_return_t indicating success βœ…

and the main character herself:

memcached_return_t memcached_dump(memcached_st *ptr, memcached_dump_fn *function, void *context, uint32_t number_of_callbacks)

🌈 Parameters 🌈

  • ptr β€” pointer to initialized memcached_st struct
  • function β€” pointer to number_of_callbacks memcached_dump_fn callbacks
  • context β€” pointer to a user managed context
  • number_of_callbacks β€” number of callbacks in the function array

🫢 Returns 🫢

memcached_return_t indicating success πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so memcached_dump() is the girl that goes and gets you a list of keys living on memcached(1) servers ✨

BUT β€” and this is important, bestie, listen β€” because memcached does not guarantee to dump all keys, you literally cannot assume you have fetched all keys from the server. like, ever. it's giving "here's what i felt like handing you" 😭

the way it works is you hand her an array of callbacks, and she'll run those callbacks on keys as she finds them. that's the whole vibe.

ngl there's a little asterisk here: currently the binary protocol is not tested. so. yeah. just so you know going in πŸ™ˆ

πŸ’€ RETURN VALUE πŸ’€

you get back a value of type memcached_return_t. on success that value will be MEMCACHED_SUCCESS. and if you wanna turn that value into something a human can read, use memcached_strerror(). periodt. πŸ‘‘


πŸ‘‘ SEE ALSO πŸ‘‘


okay that's the whole page, you ate that πŸ’– this was libmemcached-awesome version 1.1, dated Jul 24, 2025 β€” go forth and dump those keys, queen πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from