Redis SUNIONSTORE 命令
SUNIONSTORE命令用于将多个集合的并集存储在一个新的集合中。
使用格式:SUNIONSTORE destination key [key ...]
其中,destination是存储计算结果的目标集合的key,key是要计算并集的集合的key。
示例:
SADD set1 "a" "b" "c"
SADD set2 "c" "d" "e"
SUNIONSTORE destination set1 set2
执行上述命令后,destination集合中将包含所有在set1和set2中出现的元素,即集合["a", "b", "c", "d", "e"]。