Redis Cheat Sheet/Get remaining TTL in seconds

Check remaining time to live.

Section: Keys and expiration

Get remaining TTL in seconds

bash
bash
TTL session:123

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 seconds
Set a TTL in seconds.
OpenIn sheetbashsame section
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
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