Complete the code to set a key with a TTL of 60 seconds.
SET mykey "value" EX [1]
The EX option sets the TTL in seconds. Here, 60 means the key expires after 60 seconds.
Complete the command to check the remaining TTL of a key.
TTL [1]The TTL command returns the remaining time to live of the specified key. You must provide the key name.
Fix the error in the command to remove the TTL from a key.
PERSIST [1]The PERSIST command removes the TTL from the specified key, making it persistent. The key name must be provided.
Fill both blanks to set a key with a TTL of 120 seconds and then check its TTL.
SET [1] "data" EX [2] TTL [3]
First, we set the key session with a TTL of 120 seconds. Then, we check the TTL of the same key.
Fill all three blanks to set a key with TTL, check TTL, and then remove TTL.
SET [1] "temp" EX [2] TTL [1] PERSIST [3]
We set the key cache with a TTL of 30 seconds, check its TTL, then remove the TTL to make it persistent.