Get a range of elements from a list
method
RedisClient.lrange
@param key
The list key
@param start
Zero-based start index (negative indexes count from the end)
@param stop
Zero-based stop index (negative indexes count from the end)
@returns
Promise that resolves with array of elements in the specified range
await redis.lpush("mylist", "three", "two", "one");
console.log(await redis.lrange("mylist", 0, -1)); // ["one", "two", "three"]
console.log(await redis.lrange("mylist", 0, 1)); // ["one", "two"]
console.log(await redis.lrange("mylist", -2, -1)); // ["two", "three"]
Referenced types
type KeyLike = string | ArrayBufferView | Blob