Introduction
We use SET with expiry to store data that should disappear automatically after some time. This helps keep the database clean and saves space.
SET key value [EX seconds] [PX milliseconds]
SET session_token abc123 EX 600SET cache_page snapshot PX 30000SET temp_key temp_value
SET user_token xyz789 EX 5
TTL user_token
TTL user_tokenEX option do when used with the Redis SET command?session with value abc123 that expires in 10 seconds using Redis?SET temp 100 PX 5000 TTL temp
SET user123 "John" EXPIRE 20
api_token with value xyz789 and the required expiry?Pass the test and this pattern moves unknown