SCARD

Syntax
SCARD key
Available since:
Redis Open Source 1.0.0
Time complexity:
O(1)
ACL categories:
@read, @set, @fast,
Compatibility:
Redis Enterprise and Redis Cloud compatibility

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

Examples

SADD myset "Hello" SADD myset "World" SCARD myset

Redis Enterprise and Redis Cloud compatibility

Redis
Enterprise
Redis
Cloud
Notes
✅ Standard
✅ Active-Active
✅ Standard
✅ Active-Active

Return information

Integer reply: the cardinality (number of elements) of the set, or 0 if the key does not exist.
RATE THIS PAGE
Back to top ↑