0
0
Redisquery~10 mins

XREAD for reading entries in Redis - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to read entries from a Redis stream named 'mystream' starting from the beginning.

Redis
XREAD COUNT 10 STREAMS mystream [1]
Drag options to blanks, or click blank then click option'
A0
B$
C1
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '0' will skip existing entries.
Using '-' is invalid as a stream ID.
2fill in blank
medium

Complete the code to read entries from multiple streams 'stream1' and 'stream2' starting from their last IDs.

Redis
XREAD STREAMS stream1 stream2 [1] [1]
Drag options to blanks, or click blank then click option'
A>
B0
C$
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using '0' will read all entries from the start, not just new ones.
Using '-' is not a valid stream ID.
3fill in blank
hard

Fix the error in the code to read 5 entries from 'mystream' starting after ID '1609459200000-0'.

Redis
XREAD COUNT 5 STREAMS mystream [1]
Drag options to blanks, or click blank then click option'
A1609459200000-
B1609459200000-0
C1609459200000-1
D1609459200000
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same ID returns the entry with that ID again.
Using incomplete IDs causes syntax errors.
4fill in blank
hard

Fill both blanks to read entries from 'streamA' and 'streamB' starting from the beginning and the last entry respectively.

Redis
XREAD STREAMS streamA streamB [1] [2]
Drag options to blanks, or click blank then click option'
A0
B>
C1609459200000-0
D-
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' for both streams reads only new entries, missing old ones.
Using '-' is invalid.
5fill in blank
hard

Fill all three blanks to read 3 entries from 's1' and 's2' starting from '0-0' and from the latest entry respectively.

Redis
XREAD COUNT [1] STREAMS s1 s2 [2] [3]
Drag options to blanks, or click blank then click option'
A5
B3
C>
D0-0
Attempts:
3 left
💡 Hint
Common Mistakes
Using COUNT 5 reads more entries than requested.
Swapping the stream IDs causes wrong reading points.