0
0
Redisquery~5 mins

XRANGE and XREVRANGE in Redis - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AXRANGE
BXREAD
CXREVRANGE
DXADD
What does the COUNT option do in XRANGE or XREVRANGE?
ALimits the number of entries returned
BSpecifies the end ID
CSpecifies the start ID
DDeletes entries
What ID range does XRANGE - + cover?
AFrom the largest to smallest ID
BFrom the smallest to largest ID
COnly entries with ID '-' or '+'
DNo entries
Which of these is a valid Redis Stream entry ID?
A1526985058136-0
Babc-123
C2023-04-01
DID_001
If you want entries from newest to oldest, which command do you use?
AXDEL
BXRANGE
CXREAD
DXREVRANGE
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.