hmset.3valkey - Man Page

Sets the values of multiple fields.

Synopsis

HMSET key field value [field value ...]

Description

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.

Reply

valkey-protocol(7) Simple string reply: OK.

Complexity

O(N) where N is the number of fields being set.

Acl Categories

@fast @hash @write

History

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 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)

Info

2025-10-21 9.0.0 Valkey Command Manual