expire

UK[ɪkˈspaɪə(r)] US[ɪkˈspaɪr]

vi.Expiration; documents, agreements, etc. (due to expiration) become invalid; To expire; to pass away

Third person singular: expires Present participle: expiring Past tense: expired Past participle: expired

redis EXPIREAT command syntax

Function: EXPIREAT has a similar function to EXPIRE, both are used to set the survival time for key. The difference is that the time parameter accepted by the EXPIREAT command is UNIX timestamp (unix timestamp).

Syntax: EXPIREAT key timestamp

Available versions: >= 1.2.0

Time complexity : O(1)

Return: If the survival time is set successfully, return 1. When the key does not exist or the survival time cannot be set, 0 is returned.

redis EXPIREAT command example

redis> SET cache www.google.com
OK
redis> EXPIREAT cache 1355292000     # 这个 key 将在 2012.12.12 过期
(integer) 1
redis> TTL cache
(integer) 45081860