Skip to main content

OBJECTFREQ

Syntax

OBJECTFREQ keys

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 command returns an integer representing the access frequency. If the key doesn't exist -1 and an error is returned.

Examples

Get a key's access frequency:

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