Redis - Set Sismember Command


Advertisements

Redis SISMEMBER returns an element that already exists in the set stored at the key or not.

Return Value

Integer reply

  • 1, if the element is a member of the set.
  • 0, if the element is not a member of the set, or if the key does not exist.

Syntax

Following is the basic syntax of Redis SISMEMBER command.

redis 127.0.0.1:6379> SISMEMBER KEY VALUE

Example

redis 127.0.0.1:6379> SADD myset1 "hello" 
(integer) 1 
redis 127.0.0.1:6379> SISMEMBER myset1 "hello" 
(integer) 1 
redis 127.0.0.1:6379> SISMEMBER myset1 "world" 
(integer) 0 
redis_sets.htm
Advertisements