List

LPUSH

Push an element at the head of the list.

Arguments

keybodystrrequired

The key of the list.

elementsbody*List[Any]required

One or more elements to push at the head of the list.

Response

intrequired

The length of the list after the push operation.

Example
assert redis.lpush("mylist", "one", "two", "three") == 3assert lrange("mylist", 0, -1) == ["three", "two", "one"]
Loading search…