Redis SINTERSTORE 命令在所有指定集合相交之后将元素存储在集合中,不存在的键被认为是空集,如果其中一个键为空集,则输出集也为空。
返回元素数量。
以下是Redis SINTERSTORE 命令的基本语法。
redis 127.0.0.1:6379> SINTERSTORE DESTINATION_KEY KEY KEY1..KEYN
redis 127.0.0.1:6379> SADD myset1 "hello" (integer) 1 redis 127.0.0.1:6379> SADD myset1 "foo" (integer) 1 redis 127.0.0.1:6379> SADD myset1 "bar" (integer) 1 redis 127.0.0.1:6379> SADD myset2 "hello" (integer) 1 redis 127.0.0.1:6379> SADD myset2 "Learnfk" (integer) 1 redis 127.0.0.1:6379> SINTERSTORE myset myset1 myset2 (integer) 1 redis 127.0.0.1:6379> SMEMBERS myset 1) "hello"
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)