LSET

Replaces the list element at an index.

Lists · Example verified

Syntax covered here

LSET key index element

The case targets an existing position in a populated list using a zero-based index.

Tested example & replies

Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.

# connection: default
> RPUSH queue a b c
3
# connection: default
> LSET queue 1 z
"OK"