Upstash Documentation

HPERSIST

Remove field expiration.
2 min read

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#

ArgumentRequiredRepeatableDescription
<key>YesNoRedis key targeted by the command.
FIELDS <numfields> <field> [<field> ...]YesNoFields 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.

ProtocolReply
RESP2Array of integer status codes, one per field
RESP3Array of integer status codes, one per field
Note

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.

Redis CLI
@upstash/redis
upstash_redis
ioredis
node-redis
redis-py
go-redis
jedis
redis-rs