MSET

Syntax
MSET key value [key value ...]
Available since:
1.0.1
Time complexity:
O(N) where N is the number of keys to set.
ACL categories:
@write, @string, @slow,

将给定的键设置为它们各自的值。 MSET 会用新值替换现有值,就像常规的 SET 一样。 如果你不想覆盖现有值,请参见 MSETNX

MSET 是原子操作,因此所有给定的键都会同时设置。 客户端不可能看到某些键已更新而其他键未更改的情况。

示例

MSET key1 "Hello" key2 "World" GET key1 GET key2

RESP2/RESP3 回复

Simple string reply: always OK because MSET can't fail.
RATE THIS PAGE
Back to top ↑