# HPERSIST

> Remove the time to live from one or more hash fields.

URL: https://docs.hotkv.com/commands/hpersist/

```
HPERSIST key FIELDS numfields field [field ...]
```

- Group: Hash
- Complexity: O(N) where N is the number of fields given
- HotKV Cloud: all plans
- On-Premise: no license needed

`HPERSIST` removes the time to live from each listed field of the hash at
`key`, so the fields no longer expire. The values are not changed.

`FIELDS` must come right after the key, and `numfields` must equal the number
of field names that follow.

## Return value

An array with one integer per field, in the order given, under both RESP2 and
RESP3:

| Code | Meaning |
| --- | --- |
| `-2` | The field or the key does not exist. |
| `-1` | The field exists but had no time to live. |
| `1` | The time to live was removed. |

The errors are the same as for [HTTL](https://docs.hotkv.com/commands/httl/index.md): `WRONGTYPE` for a key
that is not a hash, and the `FIELDS` / `numfields` errors.

## Examples

```
127.0.0.1:6379> HSET session:9 token "abc" user "42"
(integer) 2
127.0.0.1:6379> HEXPIRE session:9 60 FIELDS 1 token
1) (integer) 1
127.0.0.1:6379> HPERSIST session:9 FIELDS 3 token user nope
1) (integer) 1
2) (integer) -1
3) (integer) -2
127.0.0.1:6379> HTTL session:9 FIELDS 1 token
1) (integer) -1
```

## Compatibility

Same as Redis 7.4. Valkey 8 does not have hash field expiration.

## See also

[HEXPIRE](https://docs.hotkv.com/commands/hexpire/index.md), [HTTL](https://docs.hotkv.com/commands/httl/index.md), [HGETEX](https://docs.hotkv.com/commands/hgetex/index.md),
[PERSIST](https://docs.hotkv.com/commands/persist/index.md)