SUNION key [key ...]

SUNION 命令用于返回所有给定集合的并集。例如:

key1 = {a,b,c,d}
key2 = {c}
key3 = {a,c,e}
SUNION key1 key2 key3 = {a,b,c,d,e}

对于不存在 key 被当做空集合处理。

*返回值

数组: 结果集中成员数量。

*例子

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) "b"
2) "c"
3) "a"
4) "d"
5) "e"
redis>