Skip to content

feat: add MatchFunc to test values with a per-call function - #11

Merged
dunglas merged 1 commit into
mainfrom
feat/match-func
Sep 24, 2026
Merged

dunglas merged 1 commit into
mainfrom
feat/match-func

Conversation

@dunglas

@dunglas dunglas commented Sep 24, 2026

Copy link
Copy Markdown
Owner

MatchFunc(filterKey, test) matches a single filter with a test given for this call instead of the one given to New.

The cache key can then be a compact digest of a filter too large to keep in the cache, while the test still reads the full filter. Mercure needs it to key its subscriber cache by a SHA-256 of the update topics without a shared lookup table, which costs a lock per tested value: dunglas/mercure#1408

MatchAny is unchanged (benchstat: no significant difference).

A cache key can then be a compact digest of a filter too large to retain,
while the test still reads the full filter.
@dunglas
dunglas merged commit 0284f1f into main Sep 24, 2026
17 checks passed
@dunglas
dunglas deleted the feat/match-func branch September 24, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant