CLIENT-CACHING(3valkey)

πŸ“¦
version 9.0.6 Β· 2 versions
, in fedora 44

✨ CLIENT-CACHING ✨

okay so bestie, this is a page from the Valkey Command Manual and we're about to talk about client-caching, which is genuinely one of those tiny commands that does one thing and does it flawlessly πŸ’…


πŸŽ€ NAME πŸŽ€

client-caching β€” Instructs the server whether to track the keys in the next request.

like. it's a little note to the server. "hey girl, the keys in my next command? track them. or don't. your call, but actually it's my call." πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

CLIENT CACHING <YES | NO>

🌸 DESCRIPTION 🌸

So here's the tea, bestie. This command controls the tracking of the keys in the next command executed by the connection β€” but only when tracking is enabled in OPTIN or OPTOUT mode. If you want the full lore, go check the valkey-client-side-caching(7) client side caching documentation, it's giving background information and it's lowkey required reading. πŸ“š

So when tracking is enabled in Valkey β€” using the valkey-client-tracking(7) CLIENT TRACKING command β€” you can specify the OPTIN or OPTOUT options, so that keys in read only commands are not automatically remembered by the server to be invalidated later. Iconic behaviour, honestly.

  • When we're in OPTIN mode, we can enable the tracking of the keys in the next command by calling CLIENT CACHING yes immediately before it. Like, right before. Don't dilly-dally. ⏰
  • Similarly, when we're in OPTOUT mode and keys are normally tracked, we can avoid the keys in the next command being tracked by using CLIENT CACHING no. 🚫

Basically the command sets a state in the connection, and that state is valid only for the next command execution β€” it's a one-command-only vibe, it will modify the behavior of client tracking and then it's gone, like a situationship. 😭


πŸ’Œ REPLY πŸ’Œ

valkey-protocol(7) Simple string reply: OK β€” or an error if the argument is not "yes" or "no".

not me typing CLIENT CACHING maybe and getting yelled at. it's literally just yes or no, bestie, no in-between. πŸ™ˆ

πŸ‘‘ COMPLEXITY πŸ‘‘

O(1)

constant time, queen behaviour, no notes. ✨


🌈 ACL CATEGORIES 🌈

@connection @slow


🧚 HISTORY 🧚

  • Available since: 6.0.0

she's been here since 6.0.0 and she's been serving ever since 🫢


⭐ SEE ALSO ⭐

auth(3valkey), client(3valkey), client-capa(3valkey), client-getname(3valkey), client-getredir(3valkey), client-help(3valkey), client-id(3valkey), client-import-source(3valkey), client-info(3valkey), client-kill(3valkey), client-list(3valkey), client-no-evict(3valkey), client-no-touch(3valkey), client-pause(3valkey), client-reply(3valkey), client-setinfo(3valkey), client-setname(3valkey), client-tracking(3valkey), client-trackinginfo(3valkey), client-unblock(3valkey), client-unpause(3valkey), echo(3valkey), hello(3valkey), ping(3valkey), quit(3valkey), reset(3valkey), select(3valkey)

go read them all, i believe in you πŸ’œ


and that's the whole page, bestie!! πŸŽ€ this was Valkey version 9.0.0, dated 2025-10-21, from the CLIENT-CACHING(3valkey) manual. slay, stay cached, and remember: the tracking state lasts exactly one command and then it's over πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from