Stream

XREVRANGE

Returns stream entries matching a given range of IDs in reverse order.

Arguments

keybodystrrequired

The key of the stream.

endbodystrdefault: +

The stream entry ID to end at (highest ID).

startbodystrdefault: -

The stream entry ID to start from (lowest ID).

countbodyint

The maximum number of entries to return.

Response

List[List[Any]]

Returns a list of stream entries in reverse chronological order. Each entry contains the ID and field-value pairs.

All entries (reverse order)
result = redis.xrevrange("mystream", "+", "-")
Limited count
result = redis.xrevrange("mystream", "+", "-", count=2)
Specific range
result = redis.xrevrange("mystream", end="1638360173533-2", start="1638360173533-0")
[  ["1638360173533-2", ["field1", "value5", "field2", "value6"]],  ["1638360173533-1", ["field1", "value3", "field2", "value4"]],  ["1638360173533-0", ["field1", "value1", "field2", "value2"]]]
Loading search…