What's new in Valkey 9.0? Discover new features and improvements. Read the announcement.

OBJECT IDLETIME

Returns the time since the last access to an object.

Usage
OBJECT IDLETIME key
Complexity
O(1)
Since
2.2.3
ACL Categories
@keyspace, @read, @slow
Command flags
READONLY

This command returns the time in seconds since the last access to the value stored at <key>.

The command is only available when the maxmemory-policy configuration directive is not set to one of the LFU policies.

Replies

RESP2

One of the following: Integer reply: the idle time in seconds. Nil reply: if key doesn't exist.

RESP3

One of the following: Integer reply: the idle time in seconds. Null reply: if key doesn't exist.