Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

OBJECT IDLETIME

Last updated
OBJECT IDLETIME key
Group
Keys
Complexity
O(1)
Arity
3 (exactly, counting the command name)
HotKV Cloud
All plans
On-Premise
no license needed

OBJECT IDLETIME returns the number of seconds since key was last read or written. LRU-based eviction policies use this idle time to choose keys to evict. Commands that only inspect a key (such as OBJECT, TYPE, TTL and EXISTS) do not reset it, while TOUCH does.

Case RESP2 RESP3
The key exists Integer: idle seconds Integer
The key does not exist Nil bulk string Null

While an LFU eviction policy is selected the idle time is not tracked, and the reply is the error ERR An LFU maxmemory policy is selected, idle time not tracked. followed by a note that switching policies at runtime takes a while to settle.

127.0.0.1:6379> SET report "q3"
OK
127.0.0.1:6379> OBJECT IDLETIME report
(integer) 0
127.0.0.1:6379> OBJECT IDLETIME report
(integer) 42

Same as Redis 7 and Valkey 8.

OBJECT FREQ, TOUCH, OBJECT