hget.3valkey - Man Page
Returns the value of a field in a hash.
Synopsis
HGET key field
Description
Returns the value associated with field in the hash stored at key.
Reply
Resp2
One of the following:
- valkey-protocol(7) Bulk string reply: The value associated with the field.
- valkey-protocol(7) Nil reply: If the field is not present in the hash or key does not exist.
Resp3
One of the following:
- valkey-protocol(7) Bulk string reply: The value associated with the field.
- valkey-protocol(7) Null reply: If the field is not present in the hash or key does not exist.
Complexity
O(1)
Acl Categories
@fast @hash @read
History
- Available since: 2.0.0
Examples
127.0.0.1:6379> HSET myhash field1 "foo" (integer) 1 127.0.0.1:6379> HGET myhash field1 "foo" 127.0.0.1:6379> HGET myhash field2 (nil)
See Also
hdel(3valkey), hexists(3valkey), hexpire(3valkey), hexpireat(3valkey), hexpiretime(3valkey), hgetall(3valkey), hgetex(3valkey), hincrby(3valkey), hincrbyfloat(3valkey), hkeys(3valkey), hlen(3valkey), hmget(3valkey), hmset(3valkey), hpersist(3valkey), hpexpire(3valkey), hpexpireat(3valkey), hpexpiretime(3valkey), hpttl(3valkey), hrandfield(3valkey), hscan(3valkey), hset(3valkey), hsetex(3valkey), hsetnx(3valkey), hstrlen(3valkey), httl(3valkey), hvals(3valkey)
Info
2025-10-21 9.0.0 Valkey Command Manual