w3resource

Redis Sets: SCARD key

SCARD key

Redis SCARD command is used to return the number of elements stored in the set.

Syntax:

SCARD KEY_NAME

Available since

1.0.0.

Return Value:

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

Return Value Type:

Integer

Example: Redis SCARD

127.0.0.1:6379> SADD mycolor "Red" "Green"
(integer) 2
127.0.0.1:6379> SADD mycolor "Blue" "Yellow"
(integer) 2
127.0.0.1:6379> SCARD mycolor
(integer) 4


Follow us on Facebook and Twitter for latest update.