0
0
Redisquery~10 mins

Why memory optimization matters in Redis - Test Your Understanding

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

Complete the code to set a key with an expiration time in Redis.

Redis
SET mykey myvalue EX [1]
Drag options to blanks, or click blank then click option'
ADEL
Bmyvalue
C60
DGET
Attempts:
3 left
💡 Hint
Common Mistakes
Using a command like GET instead of a number for expiration.
Forgetting to specify the expiration time after EX.
2fill in blank
medium

Complete the command to check the memory usage of a key in Redis.

Redis
MEMORY [1] mykey
Drag options to blanks, or click blank then click option'
AUSAGE
BGET
CDEL
DSET
Attempts:
3 left
💡 Hint
Common Mistakes
Using GET or DEL instead of USAGE.
Not specifying the key after the command.
3fill in blank
hard

Fix the error in the command to delete all keys matching a pattern.

Redis
KEYS [1] | xargs [2]
Drag options to blanks, or click blank then click option'
A*
BDEL
CGET
DSET
Attempts:
3 left
💡 Hint
Common Mistakes
Using DEL, GET, or SET as the pattern instead of '*'.
Using xargs with GET or SET instead of DEL.
Not using a wildcard pattern to match keys.
4fill in blank
hard

Fill both blanks to create a Redis command that sets a key only if it does not exist and expires after 120 seconds.

Redis
SET mykey myvalue [1] [2] 120
Drag options to blanks, or click blank then click option'
ANX
BXX
CEX
DPX
Attempts:
3 left
💡 Hint
Common Mistakes
Using XX instead of NX, which sets only if the key exists.
Using PX instead of EX, which sets expiration in milliseconds.
5fill in blank
hard

Fill all three blanks to create a Redis command that sets a counter key with expiration in milliseconds.

Redis
SET [1] 1 [2] [3]
Drag options to blanks, or click blank then click option'
Amycounter
BPX
C60000
DEX
Attempts:
3 left
💡 Hint
Common Mistakes
Using EX instead of PX for milliseconds.
Not specifying the key name.
Wrong expiration time value.