HMSET(3valkey)
π HMSET β the valkey command manual, but make it a group chat π
okay so bestie, you're in the Valkey Command Manual and today's main character is HMSET. let's get into it π«Ά
β¨ NAME β¨
hmset β sets the values of multiple fields. that's it, that's the whole job, and she does it flawlessly π
πΈ SYNOPSIS πΈ
HMSET key field value [field value ...]
π¦ DESCRIPTION π¦
So here's the tea π: HMSET sets the specified fields to their respective values in the hash stored at key. Basically you hand her a lil shopping list of field-value pairs and she just... does them all. no drama.
She overwrites any specified fields that already exist in the hash. like, sorry not sorry, the old value is gone, that's just the vibe. π₯
And if key doesn't exist? no worries queen, a brand new key holding a hash gets created for you. she's literally building it from scratch, main character energy fr fr π
π Alternative π
HSET with multiple field-value pairs. same energy, newer name, iykyk β¨
π REPLY π
valkey-protocol(7) Simple string reply: OK.
(just OK. she's a girl of few words and honestly? iconic.)
β COMPLEXITY β
O(N) where N is the number of fields being set.
translation: the more fields you throw at her, the more work it is. no cap.
π ACL CATEGORIES π
@fast @hash @write
π HISTORY π
- Available since: 2.0.0 β she's been slaying since day one, a true veteran π
π EXAMPLES π
127.0.0.1:6379> HMSET myhash field1 "Hello" field2 "World"
OK
127.0.0.1:6379> HGET myhash field1
"Hello"
127.0.0.1:6379> HGET myhash field2
"World"
see how she set two fields in one go and then HGET pulled them right back out? obsessed. ate and left no crumbs π§
π SEE ALSO π
hdel(3valkey)hexists(3valkey)hexpire(3valkey)hexpireat(3valkey)hexpiretime(3valkey)hget(3valkey)hgetall(3valkey)hgetex(3valkey)hincrby(3valkey)hincrbyfloat(3valkey)hkeys(3valkey)hlen(3valkey)hmget(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 whole page bestie, go forth and set those fields πβ¨
mwah π this was version 9.0.0, dated 2025-10-21, and it's your girl HMSET(3valkey) signing off β stay hydrated, read your manpages, and don't forget to HGET what you HMSET ππ¦
π¦ 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