Redis Expireat Command
The Redis Expireat command is used to set the expiration time of a key in UNIX timestamp format. After the key expires, it will no longer be available.
Syntax
The basic syntax of the redis Expireat command is as follows:
redis 127.0.0.1:6379> Expireat KEY_NAME TIME_IN_UNIX_TIMESTAMP
Available versions
>= 1.0.0
Return value
Setting success returns 1. If the key does not exist or the expiration time cannot be set for the key (for example, if you attempt to update the expiration time of a key in Redis versions lower than 2.1.3), it returns 0.
Example
First create a key and assign a value:
redis 127.0.0.1:6379> SET examplekey redis OK
Set an expiration time for the key:
redis 127.0.0.1:6379> EXPIREAT examplekey 1293840000 (integer) 1 redis 127.0.0.1:6379> EXISTS examplekey (integer) 0
Other extensions
Redis key