OBJECT refcount

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Get information about a key

Usage is OBJECT refcount key.
refcount: shows the value reference count.
Integer values from 0 to 9999 are pre-created inside Redis, and when the same value is stored it is referenced and refcount is increased.
Those values already exist, so refcount starts at 1. After set key 0, refcount is 2.
Other values have refcount 1.

Example

Command>set key1 0
Result>OK
Command>object refcount key1
Result>2
Command>set key2 0
Result>OK
Command>object refcount key2
Result>3
Command>set key3 A
Result>OK
Command>object refcount key3
Result>1
Command>set key4 A
Result>OK
Command>object refcount key4
Result>1

View animation



Syntax

OBJECT refcount key

  • Available since version 2.2.3.
  • Time complexity is O(1)
Related commands

<< OBJECT idletime OBJECT refcount OBJECT time >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.