ttl

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

// Using promises (NodeJS only)
kuzzle.memoryStorage.ttlPromise('key')
  .then(ttl => {
    // resolved once the action has completed
  });
kuzzle.memoryStorage.ttl("key", new ResponseListener<Long>() {
  @Override
  public void onSuccess(int ttl) {
    // callback called once the action has completed
  }

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

use \Kuzzle\Kuzzle;


$kuzzle = new Kuzzle('localhost');

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

}

Callback response:

42

Returns the remaining time to live of a key, in seconds, or a negative value if the key does not exist or if it is persistent.

[Redis documentation]


ttl(key, [options], callback)

ArgumentsTypeDescription
keystringKey identifier
optionsJSON ObjectOptional parameters
callbackfunctionCallback

Options

OptionTypeDescriptionDefault
queuablebooleanMark this request as (not) queuabletrue

Callback response

Resolves to an integer containing the remaining time to live of the key, in seconds.