ZCARD

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Return the number of members

Usage: zcard key.
ZLEN is also accepted.

Example

Command>zadd myzip  9926 "Seoul" 3426 "Busan" 2465 "Daegu" 2826 "Incheon" 1514 "Gwangju" 12137 "Gyeonggi"
Result>6
Command>zadd myzip  1500 "Gangwon" 2060 "Chungnam" 2641 "Gyeongbuk" 570 "Jeju"
Result>4
Command>zcard myzip
Result> 10   number of members in myzip
2013 regional population figures (unit: thousands)


Syntax

ZCARD key

  • Available since version 1.2.0.
  • Time complexity is O(1).
Related commands ZCOUNT, RANGE, SCARD, LLEN,
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< ZREVRANGEBYLEX ZCARD ZCOUNT >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.