OBJECTIDLETIME
Syntax
OBJECTIDLETIME key
Module
genericCategories
keyspace read slowDescription
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
- Go (Embedded)
- CLI
Get a key's idle time:
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
idletime, err := db.ObjectIdleTime("key")
Get the idle time of a key:
> OBJECTIDLETIME key