IRange,IGetRange

PHP Redis

lRange, lGetRange

Description

Returns the specified elements of the list stored at the specified key in the range [start, end]. start and stop are interpretated as indices: 0 the first element, 1 the second ... -1 the last element, -2 the penultimate ...

取得指定索引值范围内的所有元素。

Parameters

key start end

Return value

Array containing the values in specified range.

Example
$redis->rPush('key1', 'A');
$redis->rPush('key1', 'B');
$redis->rPush('key1', 'C');
$redis->lRange('key1', 0, -1); /* array('A', 'B', 'C') */