Use HPERSIST to remove the expiration from hash fields so that they stop being deleted automatically.
The reply holds one status code per requested field, in order: 1 when an expiration was removed, -1 when the field exists but had no expiration, and -2 when the field or the key does not exist. This is how a field set by HEXPIRE or HSETEX is promoted from temporary to permanent without rewriting its value.
FIELDS <numfields> introduces the field list and the count must match.
Syntax#
Arguments#
| Argument | Required | Repeatable | Description |
|---|---|---|---|
<key> | Yes | No | Redis key targeted by the command. |
FIELDS <numfields> <field> [<field> ...] | Yes | No | Fields to target. Give the field count first, then that many field names. |
Response#
The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.
| Protocol | Reply |
|---|---|
| RESP2 | Array of integer status codes, one per field |
| RESP3 | Array of integer status codes, one per field |
Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.
Examples#
TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.