Redis SINTER 命令指定集合相交之后获取集合的元素,不存在的键被认为是空集,如果其中一个键为空集,则输出集也为空。
返回数组,列出输出集的元素。
链接:https://www.learnfk.comhttps://www.learnfk.com/redis/sets-sinter.html
来源:LearnFk无涯教程网
以下是Redis SINTER 命令的基本语法。
redis 127.0.0.1:6379> SINTER KEY KEY1..KEYN
redis 127.0.0.1:6379> SADD myset "hello" (integer) 1 redis 127.0.0.1:6379> SADD myset "foo" (integer) 1 redis 127.0.0.1:6379> SADD myset "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> SINTER myset myset2 1) "hello"
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)