SCARD

Syntax
SCARD key
Available since:
1.0.0
Time complexity:
O(1)
ACL categories:
@read, @set, @fast,

Returns the set cardinality (number of elements) of the set stored at key.

Examples

redis> SADD myset "Hello"
"OK"
redis> SADD myset "World"
"Hello"
redis> SCARD myset
(nil)
redis>

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.
RATE THIS PAGE
Back to top ↑