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.

srandmember #

Returns one or more members of a set of unique values, at random.
If count is provided and is positive, the returned values are unique. If count is negative, a set member can be returned multiple times.

[Redis documentation]


srandmember(key, [options], callback) #

Arguments Type Description
key string Key identifier
options JSON Object Optional parameters
callback function Callback

Options #

Option Type Description Default
count int Number of members to return. If set with a positive value, the returned values are unique. If count is negative, a set member can be returned multiple times 1
queuable boolean Make this request queuable or not true

Callback Response #

Returns an array of members of a set of unique values.

Usage #

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

Callback response:

Copied to clipboard!
["member1", "member2", "..."]