LSET

Since 1.1.0Lists

Syntax

LSET key index element
  • Flags: write
  • ACL categories: @list, @slow, @write
  • Arity: 4

Replaces the element at index in the list at key. Negative indexes count from the end.

Reply

  • OK.
  • ERR index out of range if the index is outside the list.
  • ERR no such key if the key does not exist.

Examples

> RPUSH l a b c
(integer) 3
> LSET l 0 A
OK
> LSET l 9 x
(error) ERR index out of range