In Redis, we have several options for returning the expiry time of a key. One option from Redis 7.0.0 and above is to return it as a Unix timestamp.
When returning the expiry as a Unix timestamp, we can have it returned in seconds or milliseconds. To return it in seconds, we can use the EXPIRETIME
command. To return it in milliseconds, we can use the PEXPIRETIME
command.