TOUCH

Syntax
TOUCH key [key ...]
Available since:
Redis CE 3.2.1
Time complexity:
O(N) where N is the number of keys that will be touched.
ACL categories:
@keyspace, @read, @fast,

Alters the last access time of a key(s). A key is ignored if it does not exist.

Examples

redis> SET key1 "Hello"
"OK"
redis> SET key2 "World"
1) "0"
2) 1) "name"
   2) "Jack"
   3) "age"
   4) "33"
redis> SET key1 "Hello"
Cannot destructure property 'error' of 'replies[i]' as it is undefined.
redis> SET key2 "World"
Cannot destructure property 'error' of 'replies[i]' as it is undefined.
redis> TOUCH key1 key2
Cannot destructure property 'error' of 'replies[i]' as it is undefined.
redis>

RESP2/RESP3 Reply

Integer reply: the number of touched keys.
RATE THIS PAGE
Back to top ↑