最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Redis SUNIONSTORE命令
时间:2026-08-07 14:28:58 编辑:袖梨 来源:一聚教程网
Redis SUNIONSTORE 命令类似于 SUNION 命令,但它将结果保存到 destination 集合,而不是简单地返回结果集。如果 destination 已经存在,则将其覆盖。
注意:destination 可以是 key 本身。

可用版本
SUNIONSTORE 命令可用版本:>= 1.0.0语法
Redis SUNIONSTORE 命令的基本语法如下:SUNIONSTORE destination key [key ...]
返回值
结果集中的元素数量。命令演示
127.0.0.1:6379> SADD website www.biancheng.net www.baidu.com www. #添加一个集合成员(integer) 2127.0.0.1:6379> SADD site git python svn docker(integer) 4127.0.0.1:6379> SUNIONSTORE mysite site website(integer) 6127.0.0.1:6379> SMEMBERS mysite #将结果存储在一个目标集合mysite1) "git"2) "python"3) "docker"4) "svn"5) "www.baidu.com"6) "www.biancheng.net"