Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

MSET

Last updated
MSET key value [key value ...]
Group
String
Complexity
O(N) for N keys
Arity
-3 (at least 3 words, counting the command name)
Flags
write
Keys
first 1, last final argument, step 2
HotKV Cloud
All plans
On-Premise
no license needed

MSET stores each value at its key, overwriting existing values of any type and clearing their time to live, as SET does. All keys are written together: no client sees some of them set and others not yet. If a key is named twice, the last value wins.

In a cluster, all keys must hash to the same slot.

Case RESP2 RESP3
Always Simple string OK Simple string OK

An odd number of arguments after the command name is an ERR wrong number of arguments for 'mset' command error.

127.0.0.1:6379> MSET user:1 "ada" user:2 "grace"
OK
127.0.0.1:6379> MGET user:1 user:2
1) "ada"
2) "grace"

Same as Redis 7 and Valkey 8.

MGET, MSETNX, MSETEX, SET