HTTL

Since 1.1.0Hashes

Syntax

HTTL key FIELDS numfields field [field ...]
  • Flags: readonly
  • ACL categories: @hash, @read, @slow
  • Arity: -5

Returns how long fields of the hash at key have before they expire, in seconds.

Reply

An array with one element per field:

  • the seconds left;
  • -1: the field has no expiry;
  • -2: no such field, or no such key.

Examples

> HSET s token abc user ada
(integer) 2
> HEXPIRE s 100 FIELDS 1 token
1) (integer) 1
> HTTL s FIELDS 3 token user nope
1) (integer) 100
2) (integer) -1
3) (integer) -2