Core 2.x

rpush

Appends values at the end of a list.

If the destination list does not exist, it is created holding an empty list before performing the operation.

[Redis documentation]

Arguments

Copied to clipboard!
rpush(key, values, [options]);

Arguments Type Description
key
string
List key
values
string[]
List of values to append
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 to the updated list length.

Usage

Copied to clipboard!
try {
  await kuzzle.ms.rpush('listfoo', ['foo', 'bar', 'baz']);
  // Prints: [ 'foo', 'bar', 'baz' ]
  console.log(await kuzzle.ms.lrange('listfoo', 0, -1));
} catch (error) {
  console.error(error.message);
}