HGET(3valkey)
π HGET β the 3valkey era π
okay bestie, welcome to the Valkey Command Manual section 3valkey π¦ this one's about HGET and it's honestly so simple it's iconic.
β¨ NAME β¨
hget β returns the value of a field in a hash. that's it. that's the whole job. π
πΈ SYNOPSIS πΈ
HGET key field
two arguments. no drama. we love a low-maintenance command. π
π DESCRIPTION π
so like, you got a hash chillin' at some key, right? HGET returns the value associated with field inside that hash. one field, one value, boom, done, main character energy. π
π«Ά REPLY π«Ά
RESP2
you're gonna get one of these back:
- valkey-protocol(7) Bulk string reply β the value associated with the field. yay! π
- valkey-protocol(7) Nil reply β if the field isn't present in the hash, or the
keydoesn't exist at all. π (no cap, it's just nil, don't panic)
RESP3
same vibe, slightly different flavor of nothing:
- valkey-protocol(7) Bulk string reply β the value associated with the field. still slaying. β¨
- valkey-protocol(7) Null reply β if the field isn't present in the hash, or the
keydoesn't exist. same emptiness, new protocol. π
π₯ COMPLEXITY π₯
constant time, bestie. it does not care how big your hash is. it's giving efficiency. β
π ACL CATEGORIES π
@fast @hash @read
fast, hash-related, and read-only. the holy trinity of "yes you're allowed." π
πΈ HISTORY πΈ
- Available since:
2.0.0β an elder. a legend. been here since forever and still ate. π
π 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 how field1 came back with "foo" all pretty β¨ and field2 just said (nil)? yeah. that's the whole thing. no notes. π
π§ SEE ALSO π§
your hash besties, all of them, no one left behind: 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) π
okay that's the page!! this is version 9.0.0, dated 2025-10-21, and it's from the 3valkey manual β go get that field, bestie, you got this π«Άπβ¨
π¦ where this page comes from
- fedora 44: valkey-doc 9.0.3-2.fc44 Β· CC-BY-SA-4.0
- fedora 44: valkey-doc 9.0.6-1.fc44 Β· CC-BY-SA-4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms