In Redis, how do I get the expiration date of a key? In Redis, how do I get the expiration date of a key? database database

In Redis, how do I get the expiration date of a key?


TTL key

See the documentation of the TTL command.

There is also a PTTL command since Redis 2.6 that returns the amount of time in milliseconds instead of seconds.