List

LTRIM

Trim a list to the specified range

Arguments

keybodystringrequired

The key of the list.

startbodynumberrequired

The index of the first element to keep.

endbodyTValuerequired

The index of the first element to keep.

Response

OKrequired

OK

Example
await redis.lpush("key", "a", "b", "c", "d"); await redis.ltrim("key", 1, 2); // the list is now ["b", "c"]
Loading search…