SDK
SDK PHP v3.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

zrevrange #

Identical to zrange, except that the sorted set is traversed in descending order.

[Redis documentation]


zrevrange(key, start, stop, [options], [callback]) #

ArgumentsTypeDescription
keystringKey identifier
startintStart position in the set (index starts at position 0)
stopintEnd position in the set
optionsJSON ObjectOptional parameters
callbackfunctionCallback

Options #

OptionTypeDescriptionDefault
queuablebooleanMake this request queuable or nottrue

Return Value #

Returns the MemoryStorage object to allow chaining.


Callback Response #

Returns an array of objects, each containing the following properties:

  • member: member value in the sorted set
  • score: member associated score

Usage #

<?php
use \Kuzzle\Kuzzle;
$kuzzle = new Kuzzle('localhost');
try {
  $members = $kuzzle->memoryStorage()->zrevrange('key', 0, -1);
}
catch (ErrorException $e) {
}

Callback response:

[
  { "member": "baz", "score": 3 },
  { "member": "bar", "score": 2 },
  { "member": "foo", "score": 1 }
]