MEMCACHED_TOUCH_BY_KEY(3)

πŸ’… NAME πŸ’…

memcached_touch_by_key β€” ok bestie, this is the libmemcached documentation for it, and we're gonna get you so comfy with it ✨


πŸŽ€ SYNOPSIS πŸŽ€

First things first, you gotta bring the header in:

#include <libmemcached/memcached.h>

And when you compile + link, don't forget this icon:

Compile and link with -lmemcached

🌸 memcached_touch()

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

Parameters

  • ptr β€” a pointer to an initialized memcached_st struct 🫢
  • key β€” the key you wanna touch
  • key_length β€” how long key is, not counting any terminating zero
  • expiration β€” the new expiration, either as a unix timestamp or as a relative expiration time in seconds ⏰

Returns

A memcached_return_t indicating success, periodt.

πŸ¦‹ memcached_touch_by_key()

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 β€” a pointer to an initialized memcached_st struct 🫢
  • group_key β€” the key namespace
  • group_key_length β€” how long group_key is, not counting any terminating zero
  • key β€” the key you wanna touch
  • key_length β€” how long key is, not counting any terminating zero
  • expiration β€” the new expiration, either as a unix timestamp or as a relative expiration time in seconds ⏰

Returns

A memcached_return_t indicating success, slay.


✨ DESCRIPTION ✨

So memcached_touch() is the girl who updates the expiration time on a key that already exists β€” like giving it a little glow-up on its expiry date πŸ’…

And memcached_touch_by_key()? She does the exact same thing, but she takes a master key to go find the value you're talking about. Same energy, extra key, iykyk πŸ”‘


πŸ’– RETURN VALUE πŸ’–

You get back a value of type memcached_return_t. When everything goes right, that value is MEMCACHED_SUCCESS πŸŽ‰ And if you ever need to turn it into an actual readable string, hit up memcached_strerror() β€” she'll translate it for you, fr fr.


🌈 SEE ALSO 🌈


Version 1.1, dated Jul 24, 2025 β€” that's the whole vibe, bestie. Go touch some keys (the memcached kind, not your phone's) πŸ’œ

πŸ“¦ where this page comes from