Recall & Review
beginner
What does the XRANGE command do in Redis Streams?
XRANGE returns a range of entries from a Redis Stream in ascending order by entry ID, between a specified start and end ID.
Click to reveal answer
beginner
How does XREVRANGE differ from XRANGE?
XREVRANGE returns entries from a Redis Stream in descending order by entry ID, between a specified end and start ID.
Click to reveal answer
beginner
What is the format of the IDs used in XRANGE and XREVRANGE commands?
IDs are strings in the format <millisecondsTime>-<sequenceNumber>, for example, '1526985058136-0'.
Click to reveal answer
intermediate
How can you limit the number of entries returned by XRANGE or XREVRANGE?
You can use the COUNT option followed by a number to limit how many entries are returned.
Click to reveal answer
intermediate
What happens if you use '-' and '+' as start and end IDs in XRANGE?
'-' means the smallest ID (start of stream), '+' means the largest ID (end of stream), so XRANGE - + returns all entries in ascending order.
Click to reveal answer
Which command returns Redis Stream entries in descending order?
✗ Incorrect
XREVRANGE returns entries in descending order by ID.
What does the COUNT option do in XRANGE or XREVRANGE?
✗ Incorrect
COUNT limits how many entries the command returns.
What ID range does XRANGE - + cover?
✗ Incorrect
'-' is smallest ID, '+' is largest ID, so it covers the full stream in ascending order.
Which of these is a valid Redis Stream entry ID?
✗ Incorrect
Redis Stream IDs are numeric timestamps plus sequence numbers separated by a dash.
If you want entries from newest to oldest, which command do you use?
✗ Incorrect
XREVRANGE returns entries in reverse order, from newest to oldest.
Explain how XRANGE and XREVRANGE commands work in Redis Streams and when you might use each.
Think about reading messages in order or reverse order.
You got /5 concepts.
Describe how to limit the number of entries returned by XRANGE or XREVRANGE and why this might be useful.
Consider performance and data size.
You got /4 concepts.