Stream

XRANGE

Returns stream entries matching a given range of IDs.

Arguments

keybodystrrequired

The key of the stream.

startbodystrdefault: -

The stream entry ID to start from. Use "-" for the first available ID.

endbodystrdefault: +

The stream entry ID to end at. Use "+" for the last available ID.

countbodyint

The maximum number of entries to return.

Response

List[Tuple[str, List[str]]]

A list of stream entries, where each entry is a tuple containing the stream ID and its associated fields and values.

All entries
result = redis.xrange("mystream", "-", "+")
Range with specific IDs
result = redis.xrange("mystream", "1548149259438-0", "1548149259438-5")
Limited count
result = redis.xrange("mystream", "-", "+", count=10)
{  "1548149259438-0": {    "field1": "value1",    "field2": "value2"  },  "1548149259438-1": {    "field1": "value3",    "field2": "value4"  }}
Loading search…