PEXPIREAT Unix milliseconds-timestamp

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Automatically delete the key at the specified Unix milliseconds timestamp

Usage: pexpireat key milliseconds-timestamp [type].
type is one of string/list/set/zset/hash/stream.
      The type argument was added in ent811. Please use it.

Example

Command>set key value
Result>1
Command>pexpireat key 1534059795141 string
Result>1
Command>pttl key string
Result>3546
Command>pttl key string
Result>-2
Command>get key
Result>(nil)


Overwriting with SET removes the expire time

After an expire time is set, if SET is run on the same key, the expire time is removed and the key is not deleted.
Commands like this are set, getset.
Commands such as incr, lpush, sadd, zadd, and hset do not remove the expire time.

Example

Command>set key value
Result>1
Command>pexpireat key 1534059795141 string
Result>1
Command>pttl key string
Result>3
Command>set key new_value
Result>1
Command>pttl key string
Result>-1
Command>get key
Result>new_value


RENAME does not remove the expire time

Changing the key name does not remove the expire time.

Example

Command>set key value
Result>1
Command>pexpireat key 1534059795141 string
Result>1
Command>rename key new_key string
Result>OK
Command>pttl key string
Result>-2
Command>get key
Result>(nil)


Syntax

PEXPIREAT key milliseconds-timestamp [type]

  • Available since version 2.6.0.
  • Time complexity is O(1).
  • The type argument was added in ent811.
Related commands SETEX, TTL, PERSIST, PSETEX, EXPIREAT, PEXPIRE, PEXPIREAT, PTTL
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< PEXPIRE PEXPIREAT PTTL >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.