LSET
LSET key index element
- Available since:
- Redis Open Source 1.0.0
- Time complexity:
- O(N) where N is the length of the list. Setting either the first or the last element of the list is O(1).
- ACL categories:
-
@write,@list,@slow, - Compatibility:
- Redis Software and Redis Cloud compatibility
Sets the list element at index to element.
For more information on the index argument, see LINDEX.
An error is returned for out of range indexes.
Required arguments
key
The name of the key that holds the list.
index
The zero-based index of the element to set. Negative indexes count from the tail.
element
The new value.
Examples
Redis Software and Redis Cloud compatibility
| Redis Software |
Redis Cloud |
Notes |
|---|---|---|
| ✅ Standard |
✅ Standard |
Return information
Simple string reply:
OK.