MEMCACHED_TOUCH(3)

πŸ’– MEMCACHED_TOUCH πŸ’–

okay bestie, welcome to MEMCACHED_TOUCH(3) β€” this one lives in the libmemcached-awesome manual, and it's literally the "hey, can you live a little longer?" function. refreshing a key's expiration like it's your duolingo streak πŸ¦‹


✨ NAME ✨

memcached_touch β€” libmemcached Documentation

no cap, that's the whole name section. short and iconic, we love a minimal queen πŸ‘‘


✨ SYNOPSIS ✨

#include <libmemcached/memcached.h>

Compile and link with -lmemcached

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

Parameters 🌸

  • ptr β€” pointer to initialized memcached_st struct
  • key β€” the key to touch
  • key_length β€” the length of key without any terminating zero
  • expiration β€” new expiration as a unix timestamp or as relative expiration time in seconds

Returns πŸ’«

memcached_return_t indicating success

memcached_return_t memcached_touch_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 initialized memcached_st struct
  • group_key β€” the key namespace
  • group_key_length β€” the length of group_key without any terminating zero
  • key β€” the key to touch
  • key_length β€” the length of key without any terminating zero
  • expiration β€” new expiration as a unix timestamp or as relative expiration time in seconds

Returns πŸ’«

memcached_return_t indicating success

heads up bestie: those two key_length / group_key_length params want the length without any terminating zero. don't be out here counting the \0, she will not be included πŸ™ˆ

✨ DESCRIPTION ✨

memcached_touch() is used to update the expiration time on an existing key. think of it as gently telling a value "you're not done yet, stay a while πŸ₯Ί". no re-uploading, no re-setting, just extending the vibe.

memcached_touch_by_key() works the same, but it takes a master key to find the given value. so it's the same energy, just routed through the namespace first β€” main character energy via the group key πŸ’…


✨ 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 β€” like, if the return value is giving cryptic, that's your translator bestie 🫢


✨ SEE ALSO ✨


and that's the whole page, periodt πŸ’– this was version 1.1, dated Jul 24, 2025 β€” go touch some keys (expiration-wise), ily, bye 🧚✨

πŸ“¦ where this page comes from