SCARD

Syntax

  1. SCARD key

Time complexity: O(1)

ACL categories: @read, @set, @fast

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

  1. dragonfly> SADD myset "Hello"
  2. (integer) 1
  3. dragonfly> SADD myset "World"
  4. (integer) 1
  5. dragonfly> SCARD myset
  6. (integer) 2