Complete the code to set a key with an expiry time of 60 seconds.
SET mykey "value" EX [1]
The EX option sets the expiry time in seconds. Here, 60 seconds is the correct expiry time.
Complete the code to set a key to expire in 5 minutes using the PX option (milliseconds).
SET session_token "abc123" PX [1]
The PX option sets expiry in milliseconds. 5 minutes = 5 * 60 * 1000 = 300000 ms.
Fix the error in the command to set a key to expire in 10 seconds.
SET user_id "12345" EX [1]
The EX option expects seconds, so 10 is correct. 10000 ms = 10 s, but EX takes seconds directly.
Fill both blanks to set a key with expiry and then check its remaining TTL.
SET cache_key "data" EX [1] TTL [2]
First, set the key cache_key to expire in 120 seconds. Then, check TTL of cache_key.
Fill all three blanks to set a key with expiry, update its expiry, and check the new TTL.
SET temp_key "value" EX [1] EXPIRE [2] [3] TTL temp_key
Set temp_key to expire in 300 seconds, then update expiry to 600 seconds using EXPIRE, and finally check TTL.