Skip to main content

OBJECTIDLETIME

Syntax​

OBJECTIDLETIME key

Module​

generic

Categories​

keyspace read slow

Description​

Get the time in seconds since the last access to the value stored at the key. The command is only available when the maxmemory-policy configuration directive is set to one of the LRU policies. This commands returns a float representing the seconds since the key was last accessed. If the key doesn't exist -1 and an error is returned.

Examples​

Get a key's idle time:

db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
idletime, err := db.ObjectIdleTime("key")