LTRIM

Keeps a specified list range and removes elements outside it.

Lists · Example verified

Syntax covered here

LTRIM key start stop

The tested range selects the first two positions of a populated list.

Tested example & replies

Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.

# connection: default
> RPUSH queue a b c
3
# connection: default
> LTRIM queue 0 1
"OK"