X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/924aa408b99837036b679bd3895f836af6bc763f..df541beae372f40e9ce82a0780171e7d7a8e67de:/doc/LtrimCommand.html diff --git a/doc/LtrimCommand.html b/doc/LtrimCommand.html index 7dce582a..08d3231a 100644 --- a/doc/LtrimCommand.html +++ b/doc/LtrimCommand.html @@ -16,7 +16,7 @@
-LtrimCommand: Contents
  LTRIM _key_ _start_ _end_
    Return value
    See also +LtrimCommand: Contents
  LTRIM _key_ _start_ _end_
    Return value

LtrimCommand

@@ -26,7 +26,7 @@
-

LTRIM _key_ _start_ _end_

+ #sidebar ListCommandsSidebar

LTRIM _key_ _start_ _end_

Time complexity: O(n) (with n being len of list - len of range)
Trim an existing list so that it will contain only the specifiedrange of elements specified. Start and end are zero-based indexes.0 is the first element of the list (the list head), 1 the next elementand so on.
For example LTRIM foobar 0 2 will modify the list stored at foobarkey so that only the first three elements of the list will remain.
_start_ and end can also be negative numbers indicating offsetsfrom the end of the list. For example -1 is the last element ofthe list, -2 the penultimate element and so on.
@@ -36,8 +36,8 @@ LPUSH mylist <someelement> LTRIM mylist 0 99
The above two commands will push elements in the list taking care thatthe list will not grow without limits. This is very useful when usingRedis to store logs for example. It is important to note that when usedin this way LTRIM is an O(1) operation because in the average casejust one element is removed from the tail of the list.
-

Return value

Status code reply

See also

- +

Return value

Status code reply +