Merge pull request #366 from seoester/ltrim-documentation

LTRIM documentation
This commit is contained in:
Lunny Xiao 2020-04-23 17:10:40 +08:00 committed by GitHub
commit 6aa617f5d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 12 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

@ -48,7 +48,7 @@ Most of the Ledisdb's commands are the same as Redis's, you can see the redis co
- [HLEN key](#hlen-key) - [HLEN key](#hlen-key)
- [HMGET key field [field ...]](#hmget-key-field-field-) - [HMGET key field [field ...]](#hmget-key-field-field-)
- [HMSET key field value [field value ...]](#hmset-key-field-value-field-value-) - [HMSET key field value [field value ...]](#hmset-key-field-value-field-value-)
- [HSCAN key cursor [MATCH match] [COUNT count] [ASC|DESC]](#hscan-key-cursor-match-match-count-count-asc|desc) - [HSCAN key cursor [MATCH match] [COUNT count] [ASC|DESC]](#hscan-key-cursor-match-match-count-count-ascdesc)
- [HSET key field value](#hset-key-field-value) - [HSET key field value](#hset-key-field-value)
- [HVALS key](#hvals-key) - [HVALS key](#hvals-key)
- [HCLEAR key](#hclear-key) - [HCLEAR key](#hclear-key)
@ -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)
@ -89,7 +90,7 @@ Most of the Ledisdb's commands are the same as Redis's, you can see the redis co
- [SISMEMBER key member](#sismember--key-member) - [SISMEMBER key member](#sismember--key-member)
- [SMEMBERS key](#smembers-key) - [SMEMBERS key](#smembers-key)
- [SREM key member [member ...]](#srem--key-member-member-) - [SREM key member [member ...]](#srem--key-member-member-)
- [SSCAN key cursor [MATCH match] [COUNT count] [ASC|DESC]](#sscan-key-cursor-match-match-count-count-asc|desc) - [SSCAN key cursor [MATCH match] [COUNT & count] [ASC|DESC]](#sscan-key-cursor-match-match-count--count-ascdesc)
- [SUNION key [key ...]](#sunion-key-key-) - [SUNION key [key ...]](#sunion-key-key-)
- [SUNIONSTORE destination key [key]](#sunionstore-destination-key-key) - [SUNIONSTORE destination key [key]](#sunionstore-destination-key-key)
- [SCLEAR key](#sclear-key) - [SCLEAR key](#sclear-key)
@ -114,30 +115,30 @@ Most of the Ledisdb's commands are the same as Redis's, you can see the redis co
- [ZREVRANGE key start stop [WITHSCORES]](#zrevrange-key-start-stop-withscores) - [ZREVRANGE key start stop [WITHSCORES]](#zrevrange-key-start-stop-withscores)
- [ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]](#zrevrangebyscore--key-max-min-withscores-limit-offset-count) - [ZREVRANGEBYSCORE key max min [WITHSCORES] [LIMIT offset count]](#zrevrangebyscore--key-max-min-withscores-limit-offset-count)
- [ZREVRANK key member](#zrevrank-key-member) - [ZREVRANK key member](#zrevrank-key-member)
- [ZSCAN key cursor [MATCH match] [COUNT count] [ASC|DESC]](#zscan-key-cursor-match-match-count-count-asc|desc)
- [ZSCORE key member](#zscore-key-member) - [ZSCORE key member](#zscore-key-member)
- [ZSCAN key cursor [MATCH match] [COUNT count] [ASC|DESC]](#zscan-key-cursor-match-match-count-count-ascdesc)
- [ZCLEAR key](#zclear-key) - [ZCLEAR key](#zclear-key)
- [ZMCLEAR key [key ...]](#zmclear-key-key-) - [ZMCLEAR key [key ...]](#zmclear-key-key-)
- [ZEXPIRE key seconds](#zexpire-key-seconds) - [ZEXPIRE key seconds](#zexpire-key-seconds)
- [ZEXPIREAT key timestamp](#zexpireat-key-timestamp) - [ZEXPIREAT key timestamp](#zexpireat-key-timestamp)
- [ZTTL key](#zttl-key) - [ZTTL key](#zttl-key)
- [ZPERSIST key](#zpersist-key) - [ZPERSIST key](#zpersist-key)
- [ZUNIONSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX]](#zunionstore-destination-numkeys-key-key--weights-weight-weight--aggregate-sum|min|max) - [ZUNIONSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX]](#zunionstore-destination-numkeys-key-key--weights-weight-weight--aggregate-summinmax)
- [ZINTERSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX]](#zinterstore-destination-numkeys-key-key--weights-weight-weight--aggregate-sum|min|max) - [ZINTERSTORE destination numkeys key [key ...] [WEIGHTS weight [weight ...]] [AGGREGATE SUM|MIN|MAX]](#zinterstore-destination-numkeys-key-key--weights-weight-weight--aggregate-summinmax)
- [ZRANGEBYLEX key min max [LIMIT offset count]](#zrangebylex-key-min-max-limit-offset-count) - [ZRANGEBYLEX key min max [LIMIT offset count]](#zrangebylex-key-min-max-limit-offset-count)
- [ZREMRANGEBYLEX key min max](#zremrangebylex-key-min-max) - [ZREMRANGEBYLEX key min max](#zremrangebylex-key-min-max)
- [ZLEXCOUNT key min max](#zlexcount-key-min-max) - [ZLEXCOUNT key min max](#zlexcount-key-min-max)
- [ZDUMP key](#zdump-key) - [ZDUMP key](#zdump-key)
- [ZKEYEXISTS key](#zkeyexists-key) - [ZKEYEXISTS key](#zkeyexists-key)
- [Scan](#scan) - [Scan](#scan)
- [XSCAN type cursor [MATCH match] [COUNT count] [ASC|DESC]](#xscan-type-cursor-match-match-count-count-asc|desc) - [XSCAN type cursor [MATCH match] [COUNT count] [ASC|DESC]](#xscan-type-cursor-match-match-count-count-ascdesc)
- [XHSCAN key cursor [MATCH match] [COUNT count] [ASC|DESC]](#xhscan-key-cursor-match-match-count-count-asc|desc) - [XHSCAN key cursor [MATCH match] [COUNT count] [ASC|DESC]](#xhscan-key-cursor-match-match-count-count-ascdesc)
- [XSSCAN key cursor [MATCH match] [COUNT count] [ASC|DESC]](#xsscan-key-cursor-match-match-count-count-asc|desc) - [XSSCAN key cursor [MATCH match] [COUNT count] [ASC|DESC]](#xsscan-key-cursor-match-match-count-count-ascdesc)
- [XZSCAN key cursor [MATCH match] [COUNT count] [ASC|DESC]](#xzscan-key-cursor-match-match-count-count-asc|desc) - [XZSCAN key cursor [MATCH match] [COUNT count] [ASC|DESC]](#xzscan-key-cursor-match-match-count-count-ascdesc)
- [Sort](#sort) - [Sort](#sort)
- [XLSORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination]](#xlsort-key-by-pattern-limit-offset-count-get-pattern-get-pattern--asc|desc-alpha-store-destination) - [XLSORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination]](#xlsort-key-by-pattern-limit-offset-count-get-pattern-get-pattern--ascdesc-alpha-store-destination)
- [XSSORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination]](#xssort-key-by-pattern-limit-offset-count-get-pattern-get-pattern--asc|desc-alpha-store-destination) - [XSSORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination]](#xssort-key-by-pattern-limit-offset-count-get-pattern-get-pattern--ascdesc-alpha-store-destination)
- [XZSORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination]](#xzsort-key-by-pattern-limit-offset-count-get-pattern-get-pattern--asc|desc-alpha-store-destination) - [XZSORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination]](#xzsort-key-by-pattern-limit-offset-count-get-pattern-get-pattern--ascdesc-alpha-store-destination)
- [Replication](#replication) - [Replication](#replication)
- [SLAVEOF host port [RESTART] [READONLY]](#slaveof-host-port-restart-readonly) - [SLAVEOF host port [RESTART] [READONLY]](#slaveof-host-port-restart-readonly)
- [FULLSYNC [NEW]](#fullsync-new) - [FULLSYNC [NEW]](#fullsync-new)
@ -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.