HSCAN

Since 1.1.0Hashes

Syntax

HSCAN key cursor [MATCH pattern] [COUNT count] [NOVALUES]
  • Flags: readonly
  • ACL categories: @hash, @read, @slow
  • Arity: -3

Goes through the fields of the hash at key a page at a time, as SCAN goes through keys. Start with cursor 0 and call again with the cursor each reply gives, until it gives 0.

Options

OptionEffect
MATCH patternReturn only fields matching a glob-style pattern.
COUNT countHow many fields to look at a call: a hint.
NOVALUESReturn field names only.

Reply

  • A two-element array: the next cursor, and a flat array of fields and values (or fields only, with NOVALUES).

Examples

> HSET h a 1 b 2 c 3
(integer) 3
> HSCAN h 0
1) "0"
2) 1) "a"
   2) "1"
   3) "b"
   4) "2"
   5) "c"
   6) "3"
> HSCAN h 0 MATCH a* NOVALUES
1) "0"
2) 1) "a"