TOUCH
TOUCH key [key ...]
- Group
- Keys
- Complexity
- O(N) for N keys
- Arity
- -2 (at least 2 words, counting the command name)
- Flags
- read-only, fast
- Keys
- first 1, last final argument, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
TOUCH records an access to each key that exists, which resets its idle time
(see OBJECT IDLETIME) and counts towards its
access frequency under an LFU eviction policy. The values are not read or
changed. It counts as an access even for a connection that has turned on
CLIENT NO-TOUCH, since recording the access is the point of the command.
Return value
Section titled “Return value”| Case | RESP2 | RESP3 |
|---|---|---|
| Always | Integer: the number of named keys that exist | Integer |
Examples
Section titled “Examples”127.0.0.1:6379> MSET a 1 b 2OK127.0.0.1:6379> TOUCH a b missing(integer) 2Compatibility
Section titled “Compatibility”Same as Redis 7 and Valkey 8.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.