- Usage:
-
SCARD key
- Complexity:
- O(1)
- Since:
- 1.0.0
Returns the set cardinality (number of elements) of the set stored at key
.
Examples
127.0.0.1:6379> SADD myset "Hello"
(integer) 1
127.0.0.1:6379> SADD myset "World"
(integer) 1
127.0.0.1:6379> SCARD myset
(integer) 2
RESP2 Reply
Integer reply: the cardinality (number of elements) of the set, or 0
if the key does not exist.
RESP3 Reply
Integer reply: The cardinality (number of elements) of the set, or 0 if the key does not exist.