PTTL

Since 1.1.0Keys

Syntax

PTTL key
  • Flags: fast, readonly
  • ACL categories: @fast, @generic, @keyspace, @read
  • Arity: 2

Returns how long key has before it expires, in milliseconds.

Reply

  • The milliseconds left.
  • -1 if the key has no expiry.
  • -2 if the key does not exist.

Examples

> PSETEX p 1500 v
OK
> PTTL p
(integer) 1500