Easy Tutorial
❮ Keys Expireat Keys Del ❯

Redis Sinterstore Command

Redis Sets

The Redis Sinterstore command stores the intersection of the given sets in the specified set. If the specified set already exists, it will be overwritten.

Syntax

The basic syntax for the redis Sinterstore command is as follows:

redis 127.0.0.1:6379> SINTERSTORE DESTINATION_KEY KEY KEY1..KEYN

Available Versions

= 1.0.0

Return Value

Returns the number of elements in the set that holds the intersection.

Example

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

Redis Sets

❮ Keys Expireat Keys Del ❯