YouTip LogoYouTip

Sorted Sets Zcard

# Redis Zcard Command | Rookie Tutorial # [Rookie Tutorial -- Learning Not Just Technology, But Dreams!](#) * (javascript:void(0);) * (javascript:void(0);) * (javascript:void(0);) * (javascript:void(0)) Redis Tutorial (#)(#)(#)(#)(#) ## Redis Commands (#)(#)(#)(#)(#)(#)(#)(#)[Redis Pub/Sub](#)(#)(#)(#)(#)(#)(#) ## Redis Advanced Tutorial [Redis Backup & Recovery](#)(#)(#)(#)(#)(#)(#)(#) [](#)(#) (#)[](#) Deep Exploration Data Management Programming Networking Scripting Scripting Languages Programming Languages Network Design & Development Development Tools Computer Science Network Services # Redis Zcard Command !(#)(#) The Redis Zcard command is used to count the number of elements in a sorted set. ### Syntax The basic syntax of redis Zcard command is as follows: redis 127.0.0.1:6379> ZCARD KEY_NAME ### Available Version >= 1.2.0 ### Return Value Returns the cardinality of the sorted set when the key exists and is of sorted set type. Returns 0 when the key does not exist. ### Example redis> ZADD myzset 1 "one"(integer) 1 redis> ZADD myzset 2 "two"(integer) 1 redis> ZCARD myzset (integer) 2 redis> !(#)(#)
← Sorted Sets ZcountSorted Sets Zadd β†’