zRemRangeByScore,zDeleteRangeByScore

PHP Redis

zRemRangeByScore, zDeleteRangeByScore

Description

Deletes the elements of the sorted set stored at the specified key which have scores in the range [start,end].

移除key对应的有序集合中scroe位于min和max(包含端点)之间的所哟元素。从2.1.6版本后开始,区间端点min和max可以被排除在外,这和ZRANGEBYSCORE的语法一样。

Parameters

key
start: double or "+inf" or "-inf" string
end: double or "+inf" or "-inf" string

Return value

LONG The number of values deleted from the sorted set

Example
$redis->zAdd('key', 0, 'val0');
$redis->zAdd('key', 2, 'val2');
$redis->zAdd('key', 10, 'val10');
$redis->zRemRangeByScore('key', 0, 3); /* 2 */