What's new in Valkey 9.0? Discover new features and improvements. Read the announcement.

HMSET

Sets the values of multiple fields.

Usage
HMSET key data ...
Complexity
O(N) where N is the number of fields being set.
Since
2.0.0
ACL Categories
@fast, @hash, @write
Command flags
WRITE, DENYOOM, FAST

Sets the specified fields to their respective values in the hash stored at key. This command overwrites any specified fields already existing in the hash. If key does not exist, a new key holding a hash is created.

Alternative

HSET with multiple field-value pairs.

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"

Replies

RESP2

RESP3