OBJECTFREQ
Syntax
OBJECTFREQ keys
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 command returns an integer representing the access frequency. If the key doesn't exist -1 and an error is returned.
Examples
- Go (Embedded)
- CLI
Get a key's access frequency:
db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
freq, err := db.ObjectFreq("key")
Get the access frequency of a key:
> OBJECTFREQ key