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.

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

Notes

This command is deprecated (since 4.0.0) and replaced by 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"

See Also

hdel(3valkey), hexists(3valkey), hget(3valkey), hgetall(3valkey), hincrby(3valkey), hincrbyfloat(3valkey), hkeys(3valkey), hlen(3valkey), hmget(3valkey), hrandfield(3valkey), hscan(3valkey), hset(3valkey), hsetnx(3valkey), hstrlen(3valkey), hvals(3valkey)

Info

2024-09-23 8.0.0 Valkey Command Manual