Redis – Set Sinter Command

  • Post author:
  • Post category:Redis
  • Post comments:2 Comments

Redis SINTER command gets the elements of a set after intersection of all specified sets. Keys that do not exist are considered to be empty sets. With one of the keys being an empty set, the resulting set is also empty (since set intersection with an empty set always results in an empty set).

Return Value

Array reply, list with members of the resulting set.

Syntax

Following is the basic syntax of Redis SINTER command.

redis 127.0.0.1:6379> SINTER KEY KEY1..KEYN

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"

This Post Has 2 Comments

Leave a Reply