The timeout of a key can be cleared in the following ways:
- Using the PERSIST command to make it a persistent key.
- The value at the key is replaced or deleted. Commands that will clear the timeout include SET, GETSET, and *STORE. Altering elements from a Redis list, set, or hash will not clear the timeout because the operation does not replace the value object at the key.
- The key is renamed by another key which does not have a timeout.
- The TTL command returns -1 if the key exists but has no associated expire and returns -2 if the key does not exist.
The EXPIREAT command is similar to EXPIRE but takes an absolute UNIX timestamp at which the key is to expire.
In addition, with effect from Redis 2.6, PEXIRE and PEXIREAT can ...