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 PEXPIRE command syntax

Function:This command is similar to the EXPIRE command, but it sets the key's survival time in milliseconds, not in seconds like the EXPIRE command.

Syntax: PEXPIRE key milliseconds

Available versions:>= 2.6.0

Time complexity : O(1)

Return: If the setting is successful, 1 will be returned. If the key does not exist or the setting fails, 0

will be returned.

redis PEXPIRE command example

redis> SET mykey "Hello"
OK
redis> PEXPIRE mykey 1500
(integer) 1
redis> TTL mykey    # TTL 的返回值以秒为单位
(integer) 2
redis> PTTL mykey   # PTTL 可以给出准确的毫秒数
(integer) 1499