YouTip LogoYouTip

Sets Scard

# Redis Scard Command [!(#) Redis Sets](#) The Redis SCARD command returns the number of elements in a set. ### Syntax The basic syntax of the Redis SCARD command is as follows: redis 127.0.0.1:6379> SCARD KEY_NAME ### Available Versions >= 1.0.0 ### Return Value The cardinality of the set. Returns 0 when the set key does not exist. ### Example redis 127.0.0.1:6379> SADD myset "hello"(integer) 1 redis 127.0.0.1:6379> SADD myset "foo"(integer) 1 redis 127.0.0.1:6379> SADD myset "hello"(integer) 0 redis 127.0.0.1:6379> SCARD myset (integer) 2 [!(#) Redis Sets](#)
← Sets SdiffSets Sadd β†’