UK [s'kɑ:rd] US [s'kɑ:rd]

abbr.signal conditioning and recording device signal conditioning and recording device

redis SCARD command syntax

Function: Return the cardinality of the set key (the number of elements in the set).

Syntax: SCARD key

Available versions: >= 1.0.0

Time complexity: O(1)

Returns: The cardinality of the set. When key does not exist, return 0.

redis SCARD command example

redis> SADD tool pc printer phone
(integer) 3
redis> SCARD tool   # 非空集合
(integer) 3
redis> DEL tool
(integer) 1
redis> SCARD tool   # 空集合
(integer) 0