zCount

PHP Redis

zCount

Description

Returns the number of elements of the sorted set stored at the specified key which have scores in the range [start,end]. Adding a parenthesis before start or end excludes it from the range. +inf and -inf are also valid limits.

返回key对应的有序集合中介于min和max间的元素的个数。

Parameters

key
start: string
end: string

Return value

LONG the size of a corresponding zRangeByScore.

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