OBJECT

Since 1.1.0Keys

Syntax

OBJECT
  • Flags: readonly
  • ACL categories: @generic, @keyspace, @read, @slow
  • Arity: -2

OBJECT is a container: its subcommands report on a single key's value, and on how the key has been used.

Subcommand
OBJECT ENCODINGthe encoding Redis would use for the value; KiviDB keeps each type one way
OBJECT IDLETIMEseconds since the key was last used, kept under an LRU or LRM maxmemory-policy
OBJECT FREQthe key's use count, kept under an LFU maxmemory-policy
OBJECT REFCOUNTalways 1: values are not shared between keys
OBJECT HELPthe list, from the server

Memory explains how use is counted for eviction, and why encodings are only names in KiviDB. OBJECT does not count as a use of the key. For a missing key, each subcommand returns nil.

OBJECT alone, or with a name that is not one of these, is an error.

Examples

> OBJECT
(error) ERR wrong number of arguments for 'object' command
> OBJECT NOPE
(error) ERR unknown subcommand
> SET a 123
OK
> OBJECT ENCODING a
"int"
> OBJECT ENCODING missing
(nil)

Subcommands

  • OBJECT ENCODING: Returns the name of the encoding Redis would use for the value at key, from the value's size and the *-max-listpack-* and set-max-intset-entries settings.
  • OBJECT FREQ: Returns the key's use count: a number that grows with how often the key is used, logarithmically, and falls with time, as Redis's LFU counter does.
  • OBJECT HELP: Lists the OBJECT subcommands, each with a line or two on what it does.
  • OBJECT IDLETIME: Returns how many seconds ago key was last read or written.
  • OBJECT REFCOUNT: Returns how many references there are to the value stored at key.