首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

sunion

代码语言:javascript
复制
SUNION key [key ...]

自1.0.0起可用。

时间复杂度: O(N)其中N是所有给定集合中元素的总数。

返回从所有给定集合的联合中产生的集合的成员。

例如:

代码语言:javascript
复制
key1 = {a,b,c,d}
key2 = {c}
key3 = {a,c,e}
SUNION key1 key2 key3 = {a,b,c,d,e}

不存在的键被认为是空集。

返回值

阵列回复:列出结果集的成员。

例子

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> SUNION key1 key2 1) "a" 2) "c" 3) "e" 4) "b" 5) "d"

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com