HGETDEL

Since 1.1.0Hashes

Syntax

HGETDEL key FIELDS numfields field [field ...]
  • Flags: write
  • ACL categories: @hash, @slow, @write
  • Arity: -5

Returns the values of fields of the hash at key and deletes those fields, in one step. numfields is how many fields follow. A hash left with no fields is deleted.

Reply

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

Examples

> HSET g x 1 y 2
(integer) 2
> HGETDEL g FIELDS 2 x nope
1) "1"
2) (nil)
> HGETALL g
1) "y"
2) "2"