Redis Cheat Sheet/Set expiration in seconds

Set a TTL in seconds.

Section: Keys and expiration

Set expiration in seconds

bash
bash
EXPIRE session:123 3600

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Keys and expiration
Set expiration in milliseconds
Set a TTL in milliseconds.
OpenIn sheetbashsame section
Expire at a Unix timestamp
Expire a key at a specific second timestamp.
OpenIn sheetbashsame section
Get remaining TTL in seconds
Check remaining time to live.
OpenIn sheetbashsame section
Check if key exists
Return how many specified keys exist.
OpenIn sheetbashsame section
Delete keys
Delete one or more keys.
OpenIn sheetbashsame section
Asynchronously delete keys
Delete keys lazily in background threads.
OpenIn sheetbashsame section