// Using callbacks (NodeJS or Web Browser)
kuzzle.memoryStorage.sadd('key', ['foo', 'bar', 'baz'], function (err, count) {
  // callback called once the action has completed

// Using promises (NodeJS only)
kuzzle.memoryStorage.saddPromise('key', ['foo', 'bar', 'baz'])
  .then(count => {
    // resolved once the action has completed
String[] items = new String[]{"foo", "bar", "baz"};

kuzzle.memoryStorage.sadd("key", items, 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()->sadd('key', ['foo', 'bar', 'baz']);
catch (ErrorException $e) {


Callback response:


Adds members to a set of unique values stored at key. If the key does not exist, it is created beforehand.

[Redis documentation]

sadd(key, members, [options], [callback])

keystringKey identifier
membersarrayMembers to add to the list of unique values
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 added elements to the set.