What's new in Valkey 9.0? Discover new features and improvements. Read the announcement.

OBJECT REFCOUNT

Returns the reference count of a value of a key.

Usage
OBJECT REFCOUNT key
Complexity
O(1)
Since
2.2.3
ACL Categories
@keyspace, @read, @slow
Command flags
READONLY

This command returns the reference count of the stored at <key>.

Replies

RESP2

One of the following: Integer reply: the number of references. Nil reply: if key doesn't exist.

RESP3

One of the following: Integer reply: the number of references. Null reply: if key doesn't exist.