TOUCH(3valkey)

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

✨ TOUCH β€” the glow-up your keys deserve ✨

okay bestie, welcome to the Valkey Command Manual page for touch, filed under section 3valkey. yes this is a manual page, yes we're gonna have fun, and yes every single fact is staying exactly where it is πŸ’–


🌸 NAME 🌸

touch β€” hands back the number of keys that actually exist out of the ones you listed, after it goes and refreshes the time they were last accessed. like a little timestamp spa day πŸ§–


πŸŽ€ SYNOPSIS πŸŽ€

TOUCH key [key...]

one key minimum, bestie. or a whole squad of them.


πŸ’… DESCRIPTION πŸ’…

TOUCH alters the last access time of a key (or keys, plural, we love a group activity).

and here's the tea: if a key doesn't exist, it just gets ignored. no error, no drama, no yelling. it's simply not invited to the party πŸ™ˆ


πŸ’Œ REPLY πŸ’Œ

valkey-protocol(7) Integer reply: the number of keys that got touched. periodt.


πŸ”₯ COMPLEXITY πŸ”₯

O(N) where N is the number of keys that will be touched. so like, the more keys, the more work. math is math 😭


πŸ‘‘ ACL CATEGORIES πŸ‘‘

@fast @keyspace @read


πŸ¦‹ HISTORY πŸ¦‹

  • Available since: 3.2.1 β€” an icon from way back, she's been slaying since 3.2.1 ⭐

🌈 EXAMPLES 🌈

watch her work:

127.0.0.1:6379> SET key1 "Hello"
OK
127.0.0.1:6379> SET key2 "World"
OK
127.0.0.1:6379> TOUCH key1 key2
(integer) 2

both keys existed, both got touched, and the reply said 2. we ate that πŸ’…βœ¨


🫢 SEE ALSO 🫢


okay that's the whole page, you're officially educated πŸ’– this one's from Valkey 9.0.0, dated 2025-10-21, and that's the vibe check, no cap πŸŽ€ go touch some keys (the database kind, obviously) πŸ¦‹

πŸ“¦ where this page comes from