PHPATHCOUNT
- Usage:
-
PHPATHCOUNT key [ PREFIX prefix ]
- Complexity:
- O(1) without PREFIX or with an empty prefix; otherwise O(L + N), where L is the prefix length and N is the total size of matching paths.
- Since:
- 9.2.0
- ACL Categories:
- @pathhash, @read, @slow
Counts the stored paths.
With PREFIX, it counts all paths that start with the specified bytes, including the exact path if it exists.
An omitted or empty prefix counts the whole Path Hash in constant time.
A nonempty prefix requires traversing the matching paths.
Reply#
Integer: the number of matching paths, or 0 if the key does not exist or no paths match.
Examples#
> PHMSET tree app FIELDS 1 host local app/api FIELDS 1 host api docs FIELDS 1 host static
OK
> PHPATHCOUNT tree
(integer) 3
> PHPATHCOUNT tree PREFIX app
(integer) 2