Skip to content

Commit 892ce26

Browse files
committed
Add ZRANGEBYLEX command
1 parent 7ba0efd commit 892ce26

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/Redis.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,6 +2256,31 @@ public function zRangeByScore( $key, $start, $end, array $options = array() ) {}
22562256
*/
22572257
public function zRevRangeByScore( $key, $start, $end, array $options = array() ) {}
22582258

2259+
/**
2260+
* Returns a lexigraphical range of members in a sorted set, assuming the members have the same score. The
2261+
* min and max values are required to start with '(' (exclusive), '[' (inclusive), or be exactly the values
2262+
* '-' (negative inf) or '+' (positive inf). The command must be called with either three *or* five
2263+
* arguments or will return FALSE.
2264+
* @param string $key The ZSET you wish to run against.
2265+
* @param int $min The minimum alphanumeric value you wish to get.
2266+
* @param int $max The maximum alphanumeric value you wish to get.
2267+
* @param int $offset Optional argument if you wish to start somewhere other than the first element.
2268+
* @param int $limit Optional argument if you wish to limit the number of elements returned.
2269+
* @return array Array containing the values in the specified range.
2270+
* @link http://redis.io/commands/zrangebylex
2271+
* @example
2272+
* <pre>
2273+
* foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $char) {
2274+
* $redis->zAdd('key', $char);
2275+
* }
2276+
*
2277+
* $redis->zRangeByLex('key', '-', '[c'); // array('a', 'b', 'c')
2278+
* $redis->zRangeByLex('key', '-', '(c'); // array('a', 'b')
2279+
* $redis->zRangeByLex('key', '-', '[c'); // array('b', 'c')
2280+
* </pre>
2281+
*/
2282+
public function zRangeByLex( $key, $min, $max, $offset = null, $limit = null ) {}
2283+
22592284
/**
22602285
* Returns the number of elements of the sorted set stored at the specified key which have
22612286
* scores in the range [start,end]. Adding a parenthesis before start or end excludes it

0 commit comments

Comments
 (0)