Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

DIGEST

Last updated
DIGEST key
Group
String
Complexity
O(N) where N is the length of the string
Arity
2 (exactly, counting the command name)
Flags
read-only, fast
Keys
first 1, last 1, step 1
HotKV Cloud
All plans
On-Premise
no license needed

DIGEST returns a 64-bit fingerprint of the string stored at key, written as 16 hexadecimal digits. It is the digest that Redis 8.10 returns for the same string. Two strings with the same value have the same digest, so you can compare a value without sending it, and pass the digest to the IFDEQ and IFDNE conditions of SET and DELEX.

A bulk string of 16 hexadecimal digits, or nil (RESP2) or null (RESP3) when the key does not exist. A key that holds another type is WRONGTYPE Operation against a key holding the wrong kind of value. No key, or an extra argument, is ERR wrong number of arguments for 'digest' command.

127.0.0.1:6379> SET session:1 token-a
OK
127.0.0.1:6379> DIGEST session:1
"f2c369a318423e95"
127.0.0.1:6379> DIGEST missing
(nil)
127.0.0.1:6379> LPUSH jobs a
(integer) 1
127.0.0.1:6379> DIGEST jobs
(error) WRONGTYPE Operation against a key holding the wrong kind of value

A Redis 8.4 command. It is not the same as DEBUG DIGEST, which fingerprints the whole dataset.

DELEX, SET, GET