0
0
Redisquery~10 mins

XTRIM for stream capping 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 trim the stream to a maximum length of 1000 entries.

Redis
XTRIM mystream MAXLEN [1]
Drag options to blanks, or click blank then click option'
A1000
B5000
C100
D10000
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number too large or too small for the intended cap.
Forgetting to specify MAXLEN before the number.
2fill in blank
medium

Complete the code to trim the stream approximately to 500 entries using the ~ option.

Redis
XTRIM mystream MAXLEN ~ [1]
Drag options to blanks, or click blank then click option'
A200
B1000
C500
D50
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the ~ for approximate trimming.
Using a wrong number for the desired cap.
3fill in blank
hard

Fix the error in the command to trim the stream to exactly 200 entries.

Redis
XTRIM mystream MAXLEN [1]
Drag options to blanks, or click blank then click option'
A200
B300
C2000
D20
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number too large or too small for the intended cap.
Confusing exact and approximate trimming options.
4fill in blank
hard

Fill both blanks to trim the stream to exactly 300 entries without approximate trimming.

Redis
XTRIM mystream MAXLEN [1] [2]
Drag options to blanks, or click blank then click option'
A300
B~
CEXACT
DMINID
Attempts:
3 left
💡 Hint
Common Mistakes
Using ~ for approximate trimming when exact is needed.
Using MINID instead of EXACT for length-based trimming.
5fill in blank
hard

Fill all three blanks to trim the stream by minimum ID, keeping entries with IDs greater than or equal to 1609459200000-0.

Redis
XTRIM mystream [1] [2] [3]
Drag options to blanks, or click blank then click option'
AMINID
B1609459200000-0
CEXACT
DMAXLEN
Attempts:
3 left
💡 Hint
Common Mistakes
Using MAXLEN instead of MINID for ID-based trimming.
Omitting EXACT for precise trimming.