English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Zremrangebyscore Command

Redis Sorted Sets (sorted set)

The Redis Zremrangebyscore command is used to remove all members from the sorted set that fall within the specified score range.

Syntax

redis Zremrangebyscore Basic Syntax of the Command:

redis 127.0.0.1:6379> ZREMRANGEBYSCORE key min max

Available Versions

>= 1.2.0

Return Value

Number of removed members.

Online Examples

redis 127.0.0.1:6379> ZRANGE salary 0 -1 WITHSCORES          # Show all members and their score values in the sorted set
1) "tom"
2) "2000"
3) "peter"
4) "3500"
5) "jack"
6) "5000"
redis 127.0.0.1:6379> ZREMRANGEBYSCORE salary 1500 3500      # Remove all members with salaries in 1500 to 3500 employees within
(integer) 2
redis> ZRANGE salary 0 -1 WITHSCORES          # Show the remaining members of the sorted set
1) "jack"
2) "5000"

Redis Sorted Sets (sorted set)