randomkey

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

// Using promises (NodeJS only)
kuzzle.memoryStorage.randomkeyPromise()
  .then(key => {
    // resolved once the action has completed
  });
kuzzle.memoryStorage.randomkey(new ResponseListener<String>() {
  @Override
  public void onSuccess(String key) {
    // callback called once the action has completed
  }

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

use \Kuzzle\Kuzzle;


$kuzzle = new Kuzzle('localhost');

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

}

Callback response:

"key2"

Returns a random key from the memory storage.

[Redis documentation]


randomkey([options], callback)

ArgumentsTypeDescription
optionsJSON ObjectOptional parameters
callbackfunctionCallback

Options

OptionTypeDescriptionDefault
queuablebooleanMark this request as (not) queuabletrue

Callback response

Resolves to one of the stored key name, at random.