LSET

Syntax
LSET key index element
Available since:
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,

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.

Return

Simple string reply

Examples

redis> RPUSH mylist "one"
Failed to fetch
redis> RPUSH mylist "two"
Failed to fetch
redis> RPUSH mylist "three"
Failed to fetch
redis> LSET mylist 0 "four"
Failed to fetch
redis> LSET mylist -2 "five"
Failed to fetch
redis> LRANGE mylist 0 -1
Failed to fetch
redis>

Feedback

If you've found issues on this page, or have suggestions for improvement, please submit a request to merge or open an issue in the repository.