Skip to main content
Use HGETEX to read hash fields and change their expiration in the same call. Without an expiration option it simply returns the values, like HMGET. EX, PX, EXAT, and PXAT give every requested field a new lifetime or deadline, and PERSIST removes the expiration so the fields stop expiring altogether. Doing both in one command is what makes sliding expirations possible per field: reading a session attribute can extend it, with no window in which another client sees the field without its refreshed lifetime. FIELDS <numfields> introduces the field list and the count must match.

Syntax

Arguments

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.
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.