Redis PEXPIREAT Command
The Redis PEXPIREAT command is used to set the expiration of a key in milliseconds. Once the key expires, it will no longer be available.
Syntax
The basic syntax of the redis PEXPIREAT command is as follows:
redis 127.0.0.1:6379> PEXPIREAT KEY_NAME TIME_IN_MILLISECONDS_IN_UNIX_TIMESTAMP
Available Version
= 1.0.0
Return Value
Returns 1 on success. Returns 0 when key does not exist or the timeout cannot be set (for example, when trying to update the timeout of a key in Redis versions lower than 2.1.3).
Example
First, create a key and assign a value:
redis 127.0.0.1:6379> SET runoobkey redis
OK
Set a timeout on the key:
redis 127.0.0.1:6379> PEXPIREAT runoobkey 1555555555005
(integer) 1
Redis Key