redis.hset(hash_name, field, value)
redis.hexpire(hash_name, field, 10)

assert redis.httl(hash_name, field) == [9]

Arguments

key
str
required

The key of the hash.

fields
Union[str, List[str]]
required

The field or list of fields to retrieve the TTL for.

Response

A list of integers representing the remaining TTL in seconds for each field.

  • -2 if the field does not exist in the hash or if the key doesn’t exist.
  • -1 if the field exists but has no associated expiration.

For more details, see HTTL documentation.

redis.hset(hash_name, field, value)
redis.hexpire(hash_name, field, 10)

assert redis.httl(hash_name, field) == [9]