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

Redis Sismember Command

Redis Sismember Command

Redis Set

The Redis Sismember command checks whether the member element is a member of the set.

Syntax

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



redis 127.0.0.1:6379> SISMEMBER KEY VALUE 

Available Version

= 1.0.0

Return Value

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

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 Set