TOUCH(3valkey)
β¨ 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 π«Ά
copy(3valkey)del(3valkey)dump(3valkey)exists(3valkey)expire(3valkey)expireat(3valkey)expiretime(3valkey)keys(3valkey)migrate(3valkey)move(3valkey)object(3valkey)object-encoding(3valkey)object-freq(3valkey)object-help(3valkey)object-idletime(3valkey)object-refcount(3valkey)persist(3valkey)pexpire(3valkey)pexpireat(3valkey)pexpiretime(3valkey)pttl(3valkey)randomkey(3valkey)rename(3valkey)renamenx(3valkey)restore(3valkey)scan(3valkey)sort(3valkey)sort_ro(3valkey)ttl(3valkey)type(3valkey)unlink(3valkey)wait(3valkey)waitaof(3valkey)
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
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms