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 FREQ

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

OBJECT FREQ returns the logarithmic access frequency counter of key, from 0 to 255, that the allkeys-lfu and volatile-lfu eviction policies use to pick keys to evict. The counter decays over time when the key is not used. Access frequencies are tracked only while an LFU policy is selected with maxmemory-policy.

Case RESP2 RESP3
The key exists Integer: the counter Integer
The key does not exist Nil bulk string Null

When the eviction policy is not an LFU one, the reply is the error ERR An LFU maxmemory policy is not selected, access frequency not tracked. followed by a note that switching policies at runtime takes a while to settle.

127.0.0.1:6379> CONFIG SET maxmemory-policy allkeys-lfu
OK
127.0.0.1:6379> SET page:home "..."
OK
127.0.0.1:6379> OBJECT FREQ page:home
(integer) 5

Same as Redis 7 and Valkey 8.

OBJECT IDLETIME, OBJECT, TOUCH