Repository navigation
Allow callers to supply the JsonLogic parse cache - #69
Open
siddarthaboddu wants to merge 1 commit into
Open
siddarthaboddu wants to merge 1 commit into
siddarthaboddu wants to merge 1 commit into
Conversation
Accept a caller-owned ConcurrentMap through JsonLogic.withParseCache so applications can choose how long to retain parsed rules. Keep the default constructor's unbounded cache and existing apply calls. Evaluate the node obtained during lookup or insertion so eviction during a call cannot discard the rule being evaluated. Refs jamsesso#45
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A long-lived
JsonLogicinstance retains every distinct rule string it parses. This addsJsonLogic.withParseCache(...)so applications can control eviction and expiry using a dedicatedConcurrentMap<String, JsonLogicNode>.An application using Caffeine can configure its cache once:
Existing
apply(rule, data)calls continue to work. Each call evaluates the parsed rule against its current input, even if the cache evicts the entry during that call. The default constructor retains its existing unbounded cache. Caffeine stays in the consuming application.Concurrent misses can parse the same rule more than once. With Caffeine 2.x, map lookups bypass its hit and miss counters.
The full JUnit suite passed (113 tests), including new coverage for reuse, caller-driven eviction, immediate eviction, and null-cache rejection. A separate integration check passed with Caffeine 2.9.3.
Related to #45. Follows up on the maintainer feedback in #56.