Update commands doc (#389)

This commit is contained in:
Lunny Xiao 2020-05-10 21:52:10 +08:00 committed by GitHub
parent b814d6a929
commit d35789ec47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View File

@ -200,6 +200,11 @@
"group": "List", "group": "List",
"readonly": true "readonly": true
}, },
"LSET": {
"arguments": "key index value",
"group": "List",
"readonly": false
},
"LTRIM": { "LTRIM": {
"arguments": "key start stop", "arguments": "key start stop",
"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)
- [LSET key index value](#lset-key-index-value)
- [LTRIM key start stop](#ltrim-key-start-stop) - [LTRIM key start stop](#ltrim-key-start-stop)
- [LTTL key](#lttl-key) - [LTTL key](#lttl-key)
- [LPERSIST key](#lpersist-key) - [LPERSIST key](#lpersist-key)
@ -1031,6 +1032,28 @@ ledis> LPOP a
one one
``` ```
### LSET key index value
Sets a value to a list element according the index offset left of the list.
**Return value**
Return OK or error message.
**Examples**
```
ledis> RPUSH a 'one'
(integer) 1
ledis> RPUSH a 'two'
(integer) 2
ledis> LSET a 1 'three'
OK
ledis> LRANGE a 0 10
1) "two"
2) "three"
```
### LRANGE key start stop ### LRANGE key start stop
Returns the specified elements of the list stored at key. The offsets start and stop are zero-based indexes, with 0 being the first element of the list (the head of the list), `1` being the next element and so on. Returns the specified elements of the list stored at key. The offsets start and stop are zero-based indexes, with 0 being the first element of the list (the head of the list), `1` being the next element and so on.