0
0
Redisquery~5 mins

PERSIST to remove expiry in Redis - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
ARenames the key
BRemoves the expiration time from the key
CDeletes the key immediately
DSets a new expiration time on the key
If a key has no expiration, what does PERSIST key return?
AError
B1
C-1
D0
Which Redis command would you use to prevent a key from expiring?
AEXPIRE
BTTL
CPERSIST
DDEL
What is the effect of running PERSIST on a key with a 10-second expiry?
AThe key no longer expires
BThe key expires immediately
CThe key expires in 10 seconds
DThe expiry is extended by 10 seconds
Which of these is NOT true about the Redis PERSIST command?
AIt sets a new expiration time
BIt removes the expiration from a key
CIt can be used to keep data permanently
DIt returns 1 if expiry was removed
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.