spop

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

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

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

use \Kuzzle\Kuzzle;


$kuzzle = new Kuzzle('localhost');

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

}

Callback response:

[ "removed element" ]

Removes and returns one or more elements at random from a set of unique values.

[Redis documentation]


spop(key, [options], [callback])

ArgumentsTypeDescription
keystringKey identifier
optionsJSON ObjectOptional parameters
callbackfunctionCallback

Options

OptionTypeDescriptionDefault
countintNumber of elements to remove1
queuablebooleanMark this request as (not) queuabletrue

Return value

Returns the MemoryStorage object to allow chaining.


Callback response

Resolves to an array of removed elements.