redis-cli EXPIRE session:abc 3600

Category: Databases & SQL

redis-cli EXPIRE session:abc 3600

Set a key's time-to-live in seconds

Makes session:abc auto-delete after 3600 seconds; TTL shows the remaining time and PERSIST removes the expiry. Expiring keys is the standard session-store pattern in Redis. Related: SET ... EX 3600.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.