ltrim

Trims an existing list so that it will contain only the specified range of elements specified.

[Redis documentation]


ltrim(key, start, stop, [options], [callback])

Arguments Type Description
key string Key identifier
start int Starting position of the range of items to keep (inclusive)
stop int Ending position of the range of items to keep (inclusive)
options JSON Object Optional parameters
callback function Callback

Options

Option Type Description Default
queuable boolean Make this request queuable or not true

Return value

Returns the MemoryStorage object to allow chaining.


Callback Response

Returns null if successful.

Usage

Copied to clipboard!
// Using callbacks (NodeJS or Web Browser)
kuzzle.memoryStorage.ltrim('key', 1, 2, function (err) {
  // callback called once the action has completed
});

// Using promises (NodeJS only)
kuzzle.memoryStorage.ltrimPromise('key', 1, 2)
  .then(() => {
    // resolved once the action has completed
  });