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.

HGET

Last updated
HGET key field
Group
Hash
Complexity
O(1)
Arity
3 (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

HGET returns the value stored in field of the hash at key. A field whose time to live has passed is treated as missing.

Case RESP2 RESP3
Field exists Bulk string: the value Bulk string
Field or key does not exist Nil bulk string Null

HGET replies with a WRONGTYPE error if key holds a value that is not a hash.

127.0.0.1:6379> HSET user:1 name "Ada"
(integer) 1
127.0.0.1:6379> HGET user:1 name
"Ada"
127.0.0.1:6379> HGET user:1 email
(nil)

Same as Redis 7.4 and Valkey 8.

HMGET, HGETALL, HGETEX, HEXISTS, HSET