Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Redis Sinter Command

Redis Sinter Command

Redis Set

The Redis Sinter command returns the intersection of all given sets. A non-existent set key is treated as an empty set. When any of the given sets is empty, the result is also empty (by set operation law).

Syntax

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



redis 127.0.0.1:6379> SINTER KEY KEY1..KEYN 

Available Version

= 1.0.0

Return Value

A list of the 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 Set