HMGET(3valkey)

๐Ÿ“ฆ
version 9.0.6 ยท 2 versions
, in fedora 44

๐Ÿ’– HMGET ๐Ÿ’–

okay bestie so this is a page from the Valkey Command Manual โ€” section 3valkey โ€” and today's main character is hmget(3valkey). yes it's a whole manual page for one lil command and honestly? it deserves it. ๐ŸŽ€


โœจ NAME โœจ

hmget โ€” grabs the values of all the fields in a hash. all of them. no cap. ๐Ÿซถ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

HMGET key field [field...]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So basically, HMGET returns the values that are chillin' with the specified fields inside the hash that lives at key. that's it. that's the whole vibe. ๐Ÿ’…

And here's the tea: if a field doesn't exist in the hash, you get a nil value back for it. no drama, no error, just nil. and because a key that doesn't exist at all is treated like an empty hash (iconic behavior honestly), running HMGET against a key that isn't even there will hand you back a whole list of nil values. every single one. it's giving "empty vibes only". ๐Ÿ•ณ๏ธโœจ

lowkey the best way to see it is just... watching it happen:

127.0.0.1:6379> HSET myhash field1 "Hello"
(integer) 1
127.0.0.1:6379> HSET myhash field2 "World"
(integer) 1
127.0.0.1:6379> HMGET myhash field1 field2 nofield
1) "Hello"
2) "World"
3) (nil)

see how nofield just... showed up as (nil)? yeah. that's the move. ๐Ÿซ 


๐Ÿ‘‘ REPLY ๐Ÿ‘‘

valkey-protocol(7) Array reply: a list of values associated with the given fields, in the same order as they are requested. order matters bestie, do not come for the ordering. ๐Ÿ”ฅ


๐Ÿ’€ COMPLEXITY ๐Ÿ’€

O(N) where N is the number of fields being requested. so the more fields you ask for, the more work it does. math is math. ๐Ÿงฎ


๐ŸŒˆ ACL CATEGORIES ๐ŸŒˆ

  • @fast
  • @hash
  • @read

โญ HISTORY โญ

  • Available since: 2.0.0 โ€” a true OG, been here since forever, main character energy from day one. ๐Ÿ•ฐ๏ธ๐Ÿ‘‘

๐ŸŽ€ SEE ALSO ๐ŸŽ€

go read these too, they're all in the same friend group:


and that's the whole page bestie!! this was version 9.0.0, dated 2025-10-21, and it's the HMGET(3valkey) manual page โ€” go forth and fetch those field values, you absolute legend. ๐Ÿ’œโœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from