MEMCACHED_DELETE(3)

πŸ’– MEMCACHED_DELETE β€” the libmemcached delete era πŸ’–

okay bestie, so this is a page straight out of libmemcached-awesome and it's literally called MEMCACHED_DELETE(3). we're deleting keys. that's the whole vibe. let's go πŸ¦‹


✨ NAME ✨

memcached_delete β€” libmemcached Documentation

no cap, that's the name and that's the job: making keys poof πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

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

memcached_return_t memcached_delete(memcached_st *ptr, const char *key,
size_t key_length, time_t expiration)

memcached_return_t memcached_delete_by_key(memcached_st *ptr, const char
*group_key, size_t group_key_length, const char *key, size_t key_length,
time_t expiration)

🌸 Parameters 🌸

  • ptr β€” pointer to an initialized memcached_st struct. like, she has to be ready, okay? no uninitialized chaos 🫢
  • group_key β€” the key namespace. her little friend group πŸ’œ
  • group_key_length β€” length of the group_key, and btw that's without any terminating zero. don't count the null, she's not invited.
  • key β€” the key to delete. the main character we're sending away πŸ‘‘
  • key_length β€” the length of the key without any terminating zero. (the original page says "the length og the key" β€” typos are iconic, we keep the facts, we just giggle πŸ“)
  • expiration β€” obsolete since memcached(1) version 1.4. yeah. she's retired. still in the signature though, so we respect her πŸ’€

⭐ Returns ⭐

memcached_return_t indicating success.


🌈 DESCRIPTION 🌈

memcached_delete() is used to delete a particular key. that's it, that's the mission. gone. deleted. not me being emotional about it 😭

memcached_delete_by_key() works the same, but it takes a master key to find the given value. so like, she uses the group to locate the friend 🧚

now the tea about expiration, and this part is important so listen up:

Expiration works by placing the item into a delete queue, which means that it won't be possible to retrieve it by the "get" command. The "add" and "replace" commands with this key will also fail (the "set" command will succeed, however). After the time passes, the item is finally deleted from server memory.

so to be clear: "get" nope, "add" nope, "replace" nope, but "set" will succeed. it's giving exclusive access, honestly ✨

Please note the the memcached server removed tests for expiration in the 1.4 version.


πŸ’… RETURN VALUE πŸ’…

A value of type memcached_return_t is returned. On success that value will be MEMCACHED_SUCCESS.

Use memcached_strerror() to translate this value to a printable string. she'll tell you what the vibes are πŸ”₯

⚠️ real talk: If you are using the non-blocking mode of the library, success only means that the message was queued for delivery. it does NOT mean it's done. it means it's on her way. big difference, bestie, don't get it twisted πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€


okay and that's the whole page, we ate πŸ’– this was libmemcached-awesome version 1.1, dated Jul 24, 2025 β€” go forth and delete responsibly, bestie, ily πŸŽ€βœ¨

πŸ“¦ where this page comes from