Easy Tutorial
❮ Lists Brpoplpush Server Flushdb ❯

Redis Sinter Command

Redis Sets

The Redis Sinter command returns the intersection of all given sets.

A non-existent set key is considered an empty set.

When one of the given sets is an empty set, the result is also an empty set (according to set operation laws).

Syntax

The basic syntax of the redis Sinter command is as follows:

redis 127.0.0.1:6379> SINTER KEY KEY1..KEYN

Available Versions

= 1.0.0

Return Value

A list of intersection members.

Example

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 "world"
(integer) 1
redis 127.0.0.1:6379> SINTER myset myset2
1) "hello"

Redis Sets

❮ Lists Brpoplpush Server Flushdb ❯