ZREMRANGEBYSCORE

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

Delete members in a score range

Usage: zremrangebyscore key min max.
min and max are the score range. Use -inf, +inf to delete all. The + of +inf can be omitted.
If min and max are used as-is, the bounds are inclusive.
To exclude min/max, prefix them with '('.

Example

Command>zadd city 50 "New Delhi" 60 "Seoul" 70 "Beijing" 80 "New York"
Result>4
Command>zrangebyscore city -inf inf withscores
Result> 0) 50 -> New Delhi
1) 60 -> Seoul
2) 70 -> Beijing
3) 80 -> New York
Command>zremrangebyscore city -inf (70
Result>2
Command>zrangebyscore city -inf inf withscores
Result> 0) 70 -> Beijing
1) 80 -> New York
Command>zremrangebyscore city -inf 70
Result>1
Command>zrangebyscore city -inf inf withscores
Result> 0) 80 -> New York

View animation



Syntax

ZREMRANGEBYSCORE key min max

  • Available since version 1.2.0.
  • Time complexity is O(log(N)+M). N is the number of members in the set, and M is the number of members to delete.
Related commands ZREMRANGEBYSCORE, ZREMRANGEBYLEX, ZREMRANGEBYRANK, SREM, HDEL
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< ZREMRANGEBYRANK ZREMRANGEBYSCORE ZREMRANGEBYLEX >>

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