Skip to main content

SCARD

Syntax

SCARD key

Time complexity: O(1)

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

Return

Integer reply: the cardinality (number of elements) of the set, or 0 if key does not exist.

Examples

dragonfly> SADD myset "Hello"
(integer) 1
dragonfly> SADD myset "World"
(integer) 1
dragonfly> SCARD myset
(integer) 2