Recall & Review
beginner
What does the Redis
PERSIST command do?The
PERSIST command removes the expiration time from a key, making it persistent (no longer set to expire).Click to reveal answer
beginner
How do you remove the expiry from a Redis key named
session123?Use the command:
PERSIST session123 to remove its expiration.Click to reveal answer
intermediate
What happens if you run
PERSIST on a key that does not have an expiry?The command returns 0, meaning no expiration was removed because the key was already persistent.
Click to reveal answer
beginner
Why would you want to use
PERSIST in Redis?To keep important data from being deleted automatically by removing its expiration time.
Click to reveal answer
intermediate
What is the return value of
PERSIST when it successfully removes the expiry?It returns 1 to indicate the expiration was removed successfully.
Click to reveal answer
What does the Redis command
PERSIST key do?✗ Incorrect
The
PERSIST command removes any expiration time, making the key persistent.If a key has no expiration, what does
PERSIST key return?✗ Incorrect
It returns 0 because there was no expiration to remove.
Which Redis command would you use to prevent a key from expiring?
✗ Incorrect
PERSIST removes the expiry, so the key stays forever.What is the effect of running
PERSIST on a key with a 10-second expiry?✗ Incorrect
PERSIST removes the expiry, so the key will not expire.Which of these is NOT true about the Redis
PERSIST command?✗ Incorrect
PERSIST does not set expiration; it removes it.Explain how the Redis
PERSIST command works and when you might use it.Think about how to stop a key from disappearing automatically.
You got /4 concepts.
Describe what happens if you run
PERSIST on a key that already has no expiration set.Consider the return value and effect on the key.
You got /3 concepts.