DIGEST
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.
Return value
Section titled “Return value”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.
Examples
Section titled “Examples”127.0.0.1:6379> SET session:1 token-aOK127.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) 1127.0.0.1:6379> DIGEST jobs(error) WRONGTYPE Operation against a key holding the wrong kind of valueCompatibility
Section titled “Compatibility”A Redis 8.4 command. It is not the same as DEBUG DIGEST, which fingerprints
the whole dataset.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.