Redis – Keys Expireat Command

  • Post author:
  • Post category:Redis
  • Post comments:1 Comment

Redis Expireat command is used to set the expiry of key in Unix timestamp format. After the expiry time, the key will not be available in Redis.

Return Value

Integer value 1 or 0

  • 1, if timeout is set for key.
  • 0, if key does not exists or timeout could not set.

Syntax

Following is the basic syntax of Redis Expireat command.

redis 127.0.0.1:6379> Expireat KEY_NAME TIME_IN_UNIX_TIMESTAMP 

Example

First, create a key in Redis and set some value in it.

redis 127.0.0.1:6379> SET Adglob redis 
OK

Now, set timeout of the previously created key.

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

This Post Has One Comment

Leave a Reply