Redis - Keys Pexpireat Command



Redis Pexpireat command is used to set expiry of key in unix timestamp specified in milliseconds. After the expiry time 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 Pexpireat command.

redis 127.0.0.1:6379> PEXPIREAT KEY_NAME TIME_IN_MILLISECONDS_IN_UNIX_TIMESTAMP

Example

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

redis 127.0.0.1:6379> SET tutorialspoint redis 
OK

Now, set timeout of the previously created key.

redis 127.0.0.1:6379> PEXPIREAT tutorialspoint 1555555555005 
(integer) 1
redis_keys.htm
Advertisements