content/commands/httl.md
Returns the remaining TTL (time to live) of a hash key's field(s) that have a set expiration. This introspection capability allows you to check how many seconds a given hash field will continue to be part of the hash key.
See also the [HPTTL]({{< relref "/commands/hpttl" >}}) command that returns the same information with millisecond resolution.
redis> HTTL no-key FIELDS 3 field1 field2 field3
(nil)
redis> HSET mykey field1 "hello" field2 "world"
(integer) 2
redis> HEXPIRE mykey 300 FIELDS 2 field1 field3
1) (integer) 1
2) (integer) -2
redis> HTTL mykey FIELDS 3 field1 field2 field3
1) (integer) 283
2) (integer) -1
3) (integer) -2
| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | <span title="Supported">✅ Standard</span> <span title="Supported"><nobr>✅ Active-Active</nobr></span> | |
{{< multitabs id="httl-return-info" tab1="RESP2" tab2="RESP3" >}}
-2 if no such field exists in the provided hash key, or the provided key does not exist.-1 if the field exists but has no associated expiration set.-tab-sep-
-2 if no such field exists in the provided hash key, or the provided key does not exist.-1 if the field exists but has no associated expiration set.{{< /multitabs >}}