ZLEN

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

Return the number of members in the key

Usage: zlen key. Same as ZCARD.
List uses LLEN, Hash uses HLEN, and Stream uses XLEN, while Set and ZSet use CARD. SLEN and ZLEN were added so the names are easier to remember.

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>zlen myzip
Result> 10
The data above is 2013 population by city/province (unit: thousands).


Syntax

ZLEN key

  • Available since Enterprise version 7.
  • Time complexity is O(1).

<< ZREVRANGEBYLEX ZCARD ZCOUNT >>

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