Skip to main content

HEXPIREAT

Note

Official reference: HEXPIREAT.

Set field expiration using a Unix timestamp in seconds.

Syntax

HEXPIREAT key unix-seconds [NX | XX | GT | LT] FIELDS numfields field [field ...]

Requires Redis 7.4+. numfields must match the number of following fields. Each field produces a RESULT row in argument order.

NX sets only absent expirations; XX changes existing expirations; GT/LT only extend/shorten them. Results: 1 set, 0 condition not met, -2 field missing, 2 deleted immediately.

Results

ReturnRowsContent
ResultSetmultipleRESULT field, LONG type

Example

HSET demo:user name mali
HEXPIREAT demo:user 2000000000 FIELDS 1 name