The Redis SISMEMBER command checks if a given element is a member of the set.

Syntax

The basic syntax of the SISMEMBER command is as follows:

1
SISMEMBER key member

It returns if member is a member of the set stored at key.

Available Since

Redis version >= 1.0.0

Time Complexity

O(1)

ACL Categories

@read, @set, @fast

Return Value

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

Example

1
2
3
4
5
6
127.0.0.1:6379> SADD key1 a b c d
(integer) 4
127.0.0.1:6379> SISMEMBER key1 a
(integer) 1
127.0.0.1:6379> SISMEMBER key1 e
(integer) 0