{
  "schema_version": 2,
  "id": "commands/hpersist",
  "title": "HPERSIST",
  "url": "https://redis.io/docs/latest/commands/hpersist/",
  "summary": "Removes the expiration time for each specified field",
  "since": "7.4.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-06-15T06:26:34-07:00",
  "page_type": "content",
  "content_hash": "1fae9edca3a3a9a7d6b7b2d2ff6f882845e6db88b8abcf26d98b0f8454514566",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Remove the existing expiration on a hash key's field(s), turning the field(s) from _volatile_ (a field\nwith expiration set) to _persistent_ (a field that will never expire as no TTL (time to live)\nis associated)."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nThe name of the key that holds the hash.\n\n</details>\n\n<details open><summary><code>FIELDS numfields field [field ...]</code></summary>\n\nThe hash fields to remove the expiration from. `numfields` is the number of fields, followed by that many field names.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "[code example]"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> | <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n* [Array reply](../../develop/reference/protocol-spec#arrays). For each field:\n    - [Integer reply](../../develop/reference/protocol-spec#integers): `-2` if no such field exists in the provided hash key, or the provided key does not exist.\n    - [Integer reply](../../develop/reference/protocol-spec#integers): `-1` if the field exists but has no associated expiration set.\n    - [Integer reply](../../develop/reference/protocol-spec#integers): `1` the expiration was removed.\n\n**RESP3:**\n\n* [Array reply](../../develop/reference/protocol-spec#arrays). For each field:\n    - [Integer reply](../../develop/reference/protocol-spec#integers): `-2` if no such field exists in the provided hash key, or the provided key does not exist.\n    - [Integer reply](../../develop/reference/protocol-spec#integers): `-1` if the field exists but has no associated expiration set.\n    - [Integer reply](../../develop/reference/protocol-spec#integers): `1` the expiration was removed."
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "redis> HSET mykey field1 \"hello\" field2 \"world\"\n(integer) 2\nredis> HEXPIRE mykey 300 FIELDS 2 field1 field2\n1) (integer) 1\n2) (integer) 1\nredis> HTTL mykey FIELDS 2 field1 field2\n1) (integer) 283\n2) (integer) 283\nredis> HPERSIST mykey FIELDS 1 field2\n1) (integer) 1\nredis> HTTL mykey FIELDS 2 field1 field2\n1) (integer) 268\n2) (integer) -1",
      "section_id": "examples"
    }
  ]
}
