Recall & Review
beginner
What does the Redis command
XREAD do?The
XREAD command reads new entries from one or more Redis streams. It returns stream entries starting from a given ID.Click to reveal answer
beginner
How do you specify which streams to read from using
XREAD?You provide the
XREAD command with the keyword STREAMS, followed by the stream names and the IDs from which to start reading.Click to reveal answer
intermediate
What does the ID
$ mean when used with XREAD?The ID
$ means to read only new entries added after the command is called, ignoring existing entries.Click to reveal answer
intermediate
What happens if you use
XREAD BLOCK 0?The command will block (wait) indefinitely until a new entry arrives in the stream, then return it.
Click to reveal answer
advanced
How can you read from multiple streams at once using
XREAD?You list multiple stream names after
STREAMS and provide one ID per stream. XREAD returns entries from all those streams starting from the given IDs.Click to reveal answer
What does
XREAD STREAMS mystream 0 do?✗ Incorrect
The ID 0 means start reading from the very first entry in the stream.
Which ID should you use with
XREAD to get only new entries added after the command runs?✗ Incorrect
The ID $ tells Redis to return only new entries added after the command is called.
What does the
BLOCK option do in XREAD?✗ Incorrect
BLOCK makes XREAD wait for new entries if none are currently available.
How do you read from two streams named 's1' and 's2' starting from their latest entries?
✗ Incorrect
Use $ for each stream to read only new entries added after the command runs.
What is the output format of
XREAD?✗ Incorrect
XREAD returns entries grouped by stream name, each with entry IDs and their field-value pairs.
Explain how to use
XREAD to read new entries from a Redis stream named 'orders'.Think about reading only new data and waiting for it.
You got /4 concepts.
Describe the difference between using ID '0' and '$' with
XREAD.Consider what entries exist before and after the command.
You got /3 concepts.