srandmember

// Using callbacks (NodeJS or Web Browser)
kuzzle.memoryStorage.srandmember('key', function (err, members) {
  // callback called once the action has completed
});

// Using promises (NodeJS only)
kuzzle.memoryStorage.srandmemberPromise('key')
  .then(members => {
    // resolved once the action has completed
  });
kuzzle.memoryStorage.srandmember("key", new ResponseListener<String[]>() {
  @Override
  public void onSuccess(String[] members) {
    // callback called once the action has completed
  }

  @Override
  public void onError(JSONObject error) {
  }
});
<?php

use \Kuzzle\Kuzzle;


$kuzzle = new Kuzzle('localhost');

try {
  $members = $kuzzle->memoryStorage()->srandmember('key');
}
catch (ErrorException $e) {

}

Callback response:

[
  "member1",
  "member2",
  "..."
]

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)

ArgumentsTypeDescription
keystringKey identifier
optionsJSON ObjectOptional parameters
callbackfunctionCallback

Options

OptionTypeDescriptionDefault
countintNumber 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 times1
queuablebooleanMark this request as (not) queuabletrue

Callback response

Resolves to an array of members of a set of unique values.