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.

zrangebyscore #

Returns all the elements in the sorted set at key with a score between min and max (inclusive). The elements are considered to be ordered from low to high scores.

[Redis documentation]


zrangebyscore(key, min, max, [options], [callback]) #

Arguments Type Description
key string Key identifier
min double Minimum score value (inclusive by default)
max double Maximum score value (inclusive by default)
options JSON Object Optional parameters
callback function Callback

Options #

Option Type Description Default
limit array Limit the result set to a range of matching elements (similar to SELECT LIMIT offset, count in SQL).
Format: [<offset(int)>, <count(int)>]
null
queuable boolean Make this request queuable or not true

Return Value #

Returns the MemoryStorage object to allow chaining.


Callback Response #

Returns an array of matching members.

Usage #

Copied to clipboard!
<?php
use \Kuzzle\Kuzzle;
$kuzzle = new Kuzzle('localhost');
try {
  $members = $kuzzle->memoryStorage()->zrangebyscore('key', 2, 3);
}
catch (ErrorException $e) {
}

Callback response:

Copied to clipboard!
[
  { "member": "foo", "score": 1 },
  { "member": "bar", "score": 2 },
  { "member": "baz", "score": 3 }
]