0
0
Redisquery~10 mins

Temporary data with TTL 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 set a key with a value in Redis.

Redis
SET mykey [1]
Drag options to blanks, or click blank then click option'
A"Hello"
BEX 10
CDEL
DGET
Attempts:
3 left
💡 Hint
Common Mistakes
Using EX 10 immediately after SET without a value.
Using DEL or GET instead of a value.
2fill in blank
medium

Complete the code to set a key with a value and an expiration time of 30 seconds.

Redis
SET mykey "Hello" [1] 30
Drag options to blanks, or click blank then click option'
APX
BTTL
CEX
DPTTL
Attempts:
3 left
💡 Hint
Common Mistakes
Using PX which sets expiration in milliseconds.
Using TTL or PTTL which are commands, not options here.
3fill in blank
hard

Fix the error in the command to set a key with expiration of 60 seconds.

Redis
SET mykey "World" [1]
Drag options to blanks, or click blank then click option'
AEXPIRE 60
BTTL 60
CPX 60000
DEX 60
Attempts:
3 left
💡 Hint
Common Mistakes
Using TTL or EXPIRE as options in SET command.
Using PX 60000 which is milliseconds, but the question expects seconds.
4fill in blank
hard

Fill both blanks to set a key with value and expiration in milliseconds.

Redis
SET mykey [1] [2] 15000
Drag options to blanks, or click blank then click option'
A"Temporary"
BEX
CPX
D"Permanent"
Attempts:
3 left
💡 Hint
Common Mistakes
Using EX instead of PX for milliseconds.
Using "Permanent" as value when temporary data is needed.
5fill in blank
hard

Fill all three blanks to set a key with value and expiration, then check its TTL.

Redis
SET [1] [2] EX 20
TTL [3]
Drag options to blanks, or click blank then click option'
Asession_token
B"abc123"
D"xyz789"
Attempts:
3 left
💡 Hint
Common Mistakes
Using different key names in SET and TTL commands.
Not using quotes around the value string.