English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Redis Expireat Command

Redis Key (key)

The Redis Expireat command is used to set the expiration time of the key in UNIX timestamp (unix timestamp) format. The key will no longer be available after expiration.

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 version

=> 1.0.0

Return value

Returns successfully set 1 . When the key does not exist or the expiration time cannot be set for the key (for example, in versions lower than 2.1.3 Returns 0 when you try to update the expiration time of a key in a version of Redis lower than the one you are using (

Online Examples

First create a key and assign a value:

redis 127.0.0.1:6379> SET w3codeboxkey redis
OK

Set the expiration time for key:

redis 127.0.0.1:6379> EXPIREAT w3codeboxkey 1293840000
(integer) 1
redis 127.0.0.1:6379> EXISTS w3codeboxkey
(integer) 0

Redis Key (key)