SUNIONSTORE destination key1 [key2]

本页内容
上一节: Sets_sunion 下一节: Sets_sscan

Redis Sunionstore 命令

Redis 集合(Set)

Redis Sunionstore 命令将给定集合的并集存储在指定的集合 destination 中。如果 destination 已经存在,则将其覆盖。

语法

redis Sunionstore 命令基本语法如下:


示例

SUNIONSTORE destination key [key ...]

可用版本

>= 1.0.0

返回值

结果集中的元素数量。

==


示例

redis> SADD key1 "a"
(integer) 1
redis> SADD key1 "b"
(integer) 1
redis> SADD key1 "c"
(integer) 1
redis> SADD key2 "c"
(integer) 1
redis> SADD key2 "d"
(integer) 1
redis> SADD key2 "e"
(integer) 1
redis> SUNIONSTORE key key1 key2
(integer) 5
redis> SMEMBERS key
1) "c"
2) "b"
3) "e"
4) "d"
5) "a"
redis>

Redis 集合(Set)

上一节: Sets_sunion 下一节: Sets_sscan
此页面最后编辑于2022年8月17日 (星期三) 23:13。