HGETEX

Since 1.1.0Hashes

Syntax

HGETEX key [EX seconds | PX ms | EXAT unix-secs | PXAT unix-ms | PERSIST] FIELDS numfields field [field ...]
  • Flags: write
  • ACL categories: @hash, @slow, @write
  • Arity: -5

Returns the values of fields of the hash at key and, optionally, changes their expiry, in one step.

Options

OptionEffect
EX, PX, EXAT, PXATGive the fields this expiry.
PERSISTRemove the fields' expiry.

Reply

  • An array with one element per field: the value, or nil for a field that does not exist.

Examples

> HSET hx a 11
(integer) 1
> HGETEX hx EX 30 FIELDS 2 a nope
1) "11"
2) (nil)
> HTTL hx FIELDS 1 a
1) (integer) 30
> HGETEX hx PERSIST FIELDS 1 a
1) "11"