Added documentation for the LTRIM command

This commit is contained in:
Seoester 2019-03-26 16:28:24 +01:00
parent 8ceb77e66a
commit 7c5bf53209
2 changed files with 26 additions and 0 deletions

View File

@ -200,6 +200,11 @@
"group": "List", "group": "List",
"readonly": true "readonly": true
}, },
"LTRIM": {
"arguments": "key start stop",
"group": "List",
"readonly": false
},
"LTTL": { "LTTL": {
"arguments": "key", "arguments": "key",
"group": "List", "group": "List",

View File

@ -75,6 +75,7 @@ Most of the Ledisdb's commands are the same as Redis's, you can see the redis co
- [LMCLEAR key [key ...]](#lmclear-key-key-) - [LMCLEAR key [key ...]](#lmclear-key-key-)
- [LEXPIRE key seconds](#lexpire-key-seconds) - [LEXPIRE key seconds](#lexpire-key-seconds)
- [LEXPIREAT key timestamp](#lexpireat-key-timestamp) - [LEXPIREAT key timestamp](#lexpireat-key-timestamp)
- [LTRIM key start stop](#ltrim-key-start-stop)
- [LTTL key](#lttl-key) - [LTTL key](#lttl-key)
- [LPERSIST key](#lpersist-key) - [LPERSIST key](#lpersist-key)
- [LDUMP key](#ldump-key) - [LDUMP key](#ldump-key)
@ -1215,6 +1216,26 @@ ledis> LTTL a
ledis> ledis>
``` ```
### LTRIM key start stop
Trims the list stored at key. Only the elements in the specified range [start, stop] remain.
**Return value**
Simple string reply: OK or error msg.
**Examples**
```
ledis> RPUSH a 1 2 3 4 5
(integer) 1
ledis> LTRIM a 2 -1
OK
ledis> LRANGE a 0 -1
1) "3"
2) "4"
3) "5"
```
### LTTL key ### LTTL key
Returns the remaining time to live of a key that has a timeout. If the key was not set a timeout, `-1` returns. Returns the remaining time to live of a key that has a timeout. If the key was not set a timeout, `-1` returns.