Set a value at a specific index.
redis.rpush("mylist", "one", "two", "three") assert redis.lset("mylist", 1, "Hello") == True assert redis.lrange("mylist", 0, -1) == ["one", "Hello", "three"] assert redis.lset("mylist", 5, "Hello") == False assert redis.lrange("mylist", 0, -1) == ["one", "Hello", "three"]
The key of the list.
At which index to set the value.
The value to set.
Returns True if the index was in range and the value was set.
True
Was this page helpful?