SCARD key
Return the set cardinality (number of elements). If the key does not exist 0 is returned, like for empty sets.
TIME COMPLEXITY: O(1)
RETURN VALUE: The cardinality (number of elements) of the set as an integer.
Syntax:
SCARD key
Example 1: When the key is present
redis:6379> SADD redisKey 100(integer) 1redis:6379> SADD redisKey 200(integer) 1redis:6379> SCARD redisKey(integer) 2
Output
2
Example 2: When the key is not present
redis:6379> SCARD redisKey(integer) 0
Output
0
No comments:
Post a Comment