PHSCAN

Usage:
PHSCAN key path cursor [ MATCH pattern ] [ COUNT count ]
Complexity:
O(L) for the path lookup plus the cost of HSCAN on its field map; COUNT is a work hint, not a hard result limit.
Since:
9.2.0
ACL Categories:
@pathhash, @read, @slow

Incrementally scans field-value pairs at the exact path. MATCH filters field names using a glob-style pattern with the same syntax as KEYS. COUNT is a positive work hint and defaults to 10. A call may return more or fewer pairs than requested, or an empty page with a nonzero cursor. Field order is unspecified.

Start with cursor 0 and continue with the returned cursor using the same key, path, and MATCH pattern until the cursor is 0 again. The cursor and iteration behavior follow HSCAN. Use PHPATHSCAN to iterate over path names.

Reply#

Two-element array with the following elements:

  • String: the next cursor as an unsigned 64-bit number, or "0" when the scan is complete.
  • Array of strings: alternating field names and values.

A missing key or path returns cursor "0" and an empty array.

Examples#

> PHSET tree app FIELDS 2 host local port 8080
OK
> PHSCAN tree app 0 MATCH h*
1) "0"
2) 1) "host"
   2) "local"