// Using callbacks (NodeJS or Web Browser)
kuzzle.memoryStorage.sdiffstore('key', ['key1', 'key2', '...'], 'destination', function (err, count) {
  // callback called once the action has completed

// Using promises (NodeJS only)
kuzzle.memoryStorage.sdiffstorePromise('key', ['key1', 'key2', '...'], 'destination')
  .then(count => {
    // resolved once the action has completed
String[] keys = new String[]{"key1", "key2", "..."};

kuzzle.memoryStorage.sdiffstore("key", keys, "destination", new ResponseListener<Long>() {
  public void onSuccess(int count) {
    // callback called once the action has completed

  public void onError(JSONObject error) {

use \Kuzzle\Kuzzle;

$kuzzle = new Kuzzle('localhost');

try {
  $count = $kuzzle->memoryStorage()->sdiffstore('key', ['key1', 'key2', '...'], 'destination');
catch (ErrorException $e) {


Callback response:


Computes the difference between the set of unique values stored at key and the other provided sets, and stores the result in the key stored at destination.

If the destination key already exists, it is overwritten.

[Redis documentation]

sdiffstore(key, keys, destination, [options], [callback])

keystringKey identifier to compare
keysarraylist of set keys to compare with the set stored at key
destinationstringDestination key identifier
optionsJSON ObjectOptional parameters


queuablebooleanMark this request as (not) queuabletrue

Return value

Returns the MemoryStorage object to allow chaining.

Callback response

Resolves to an integer containing the number of stored elements.