Usage
Parameters
The stream key(s) to read from. Can be a single key or an array of keys.
The starting ID(s) for each stream. Must match the number of keys:
"0"- Read from the beginning of the stream"<ms>-<seq>"- Read entries after this specific ID"$"- Read only new entries (commonly used with BLOCK)
key is an array, id must also be an array with the same length.Optional reading options:
Response
An array of stream data. The exact structure depends on the streams read.For single stream reads, returns entries in the format:Returns an empty array if no entries are found.
Examples
Read from beginning of stream
Read entries after a specific ID
Limit number of entries
Read from multiple streams
Poll for new entries
Read only new entries using $
Processing stream entries
Important Notes
Balanced Keys and IDs
When reading from multiple streams, the number of keys must match the number of IDs:Entry ID Positioning
XREAD returns entries after the specified ID, not including it:Special ID Values
| ID | Meaning |
|---|---|
"0" | Start from the beginning |
"$" | Only new entries (none if called once) |
"<ms>-<seq>" | Start after this specific ID |
Return Format
The response format is:Count Limit
Thecount option limits entries per stream, not total: