SDK
SDK Javascript v7.x
2

psetex #

Sets a key with the provided value, and an expiration delay expressed in milliseconds. If the key does not exist, it is created beforehand.

[Redis documentation]

Arguments #

Copied to clipboard!
psetex(key, value, milliseconds, [options]);

Arguments Type Description
key
string
Key
value
string
Value
milliseconds
integer
Number of milliseconds after which the key is deleted
options
object
Optional query arguments

options #

The options arguments can contain the following option properties:

Property Type (default) Description
queuable
boolean (true)
If true, queues the request during downtime, until connected to Kuzzle again

Resolve #

Resolves once the operation succeeds.

Usage #

Copied to clipboard!
try {
  await kuzzle.ms.psetex('foo', 'bar', 60000);
  // Prints: 60
  console.log(await kuzzle.ms.ttl('foo'));
  // Prints: bar
  console.log(await kuzzle.ms.get('foo'));
} catch (error) {
  console.error(error.message);
}