无涯教程-Redis - SINTER 命令函数

13 阅读1分钟

Redis SINTER 命令指定集合相交之后获取集合的元素,不存在的键被认为是空集,如果其中一个键为空集,则输出集也为空。

SINTER - 返回值

返回数组,列出输出集的元素。

SINTER - 语法

以下是Redis SINTER 命令的基本语法。

redis 127.0.0.1:6379> SINTER KEY KEY1..KEYN

SINTER - 示例

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"

参考链接

www.learnfk.com/redis/sets-…