/** * @see zRangeByScore() * * @param string $key * @param int $start * @param int $end * @param array $options * * @return array */ public function zRevRangeByScore($key, $start, $end, array $options = array()) { try { return $this->client->zRevRangeByScore($key, $start, $end, $options); } catch (Exception $e) { return $this->handleException($e, __FUNCTION__, func_get_args()); } }
/** * Compare the results of zrevrange using non-multi and multi mode */ public function testZRevRangeByScoreCompareMulti() { $memkey = "n_29,27,11,14,c/23336,106386,160879,341828"; $this->redis->zAdd($memkey, 123, 0.1); $this->redis->zAdd($memkey, 124, 0.2); // without pipeline $opts = array('withscores' => true); $resWithoutPipeline = $this->redis->zRevRangeByScore($memkey, '+inf', '-inf', $opts); // with multi $this->redis->multi(); $this->redis->zRevRangeByScore($memkey, '+inf', '-inf', $opts); $resWithMulti = $this->redis->exec(); // with pipeline $this->redis->pipeline(); $this->redis->zRevRangeByScore($memkey, '+inf', '-inf', $opts); $resWithPipeline = $this->redis->exec(); $this->assertEquals($resWithMulti[0], $resWithoutPipeline); $this->assertEquals($resWithMulti[0], $resWithPipeline[0]); $this->assertEquals($resWithPipeline[0], $resWithoutPipeline); }
/** * @see zRangeByScore() * * @param string $key * @param int $start * @param int $end * @param array $options * * @return array */ public function zRevRangeByScore($key, $start, $end, array $options = array()) { $this->appendToLog('ZREVRANGEBYSCORE ' . $key . ' ' . $start . ' ' . $end . (isset($options['withscores']) && $options['withscores'] ? ' WITHSCORES' : null) . (isset($options['limit']) && $options['limit'] ? ' LIMIT ' . $options['limit'][0] . ' ' . $options['limit'][1] : null)); return $this->client->zRevRangeByScore($key, $start, $end, $options); }