Redis Zremrangebyscore 命令
Redis Zremrangebyscore 命令用於移除有序集中,指定分數(score)區間內的所有成員。
語法
redis Zremrangebyscore 命令基本語法如下:
redis 127.0.0.1:6379> ZREMRANGEBYSCORE key min max
可用版本
>= 1.2.0
返回值
被移除成員的數量。
實例
redis 127.0.0.1:6379> ZRANGE salary 0 -1 WITHSCORES # 顯示有序集內所有成員及其 score 值 1) "tom" 2) "2000" 3) "peter" 4) "3500" 5) "jack" 6) "5000" redis 127.0.0.1:6379> ZREMRANGEBYSCORE salary 1500 3500 # 移除所有薪水在 1500 到 3500 內的員工 (integer) 2 redis> ZRANGE salary 0 -1 WITHSCORES # 剩下的有序集成員 1) "jack" 2) "5000"