PEXPIRE

Since 1.1.0Keys

Syntax

PEXPIRE key milliseconds [NX | XX | GT | LT]
  • Flags: fast, write
  • ACL categories: @fast, @generic, @keyspace, @write
  • Arity: -3

Makes key expire after milliseconds. It takes the same NX, XX, GT and LT conditions as EXPIRE.

Reply

  • 1 if the expiry was set; 0 if the key does not exist or the condition was not met.

Examples

> SET a 1
OK
> PEXPIRE a 5000
(integer) 1
> PTTL a
(integer) 5000