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

// Using promises (NodeJS only)
kuzzle.memoryStorage.pexpirePromise('key', 42000)
  .then(status => {
    // resolved once the action has completed
kuzzle.memoryStorage.pexpire("key", 42000, new ResponseListener<Integer>() {
  public void onSuccess(int status) {
    // callback called once the action has completed

  public void onError(JSONObject error) {

use \Kuzzle\Kuzzle;

$kuzzle = new Kuzzle('localhost');

try {
  $status = $kuzzle->memoryStorage()->pexpire('key', 42000);
catch (ErrorException $e) {


Callback response:


Sets a timeout (in milliseconds) on a key. After the timeout has expired, the key will automatically be deleted.

[Redis documentation]

pexpire(key, ttl, [options], [callback])

keystringKey identifier
ttlintTime to live of the key, in milliseconds
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 operation status (0: fail, 1: success).