List

LRANGE

Returns the specified elements of the list stored at key.

Arguments

keybodystrrequired

The key of the list.

startbodyintrequired

The starting index of the range to return.

Use negative numbers to specify offsets starting at the end of the list.

endbodyintrequired

The ending index of the range to return.

Use negative numbers to specify offsets starting at the end of the list.

Response

List[str]

The list of elements in the specified range.

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