exists

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

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

kuzzle.memoryStorage.exists(keys, new ResponseListener<Long>() {
  @Override
  public void onSuccess(int count) {
    // callback called once the action has completed
  }

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

use \Kuzzle\Kuzzle;


$kuzzle = new Kuzzle('localhost');

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

}

Callback response:

2

Checks if the specified keys exist in the database.

[Redis documentation]


exists(keys, [options], callback)

ArgumentsTypeDescription
keysarrayList of keys to check for existence
optionsJSON ObjectOptional parameters
callbackfunctionCallback

Options

OptionTypeDescriptionDefault
queuablebooleanMark this request as (not) queuabletrue

Callback response

Resolves to an integer containing the number of existing keys amongst the provided list.