json-logic-java icon indicating copy to clipboard operation
json-logic-java copied to clipboard

Add a cache eviction policy for parseCache

Open mayankpruthii opened this issue 11 months ago • 1 comments

Whenever JsonLogic's apply method is called for a json rule, it puts the json rule in a cache called parseCache in src/JsonLogic.java and creates a JsonLogicNode object from the stringified json rule. This cache helps in redundant calls for parsing the same json rule to the JsonLogicNode parser.

But the cache does not have any conviction policy. If the consumer ends up calling JsonLogic.apply for multiple distinct rules, the cache can quickly fill up the memory of the system and cause performance bottlenecks.

mayankpruthii avatar Jan 16 '25 13:01 mayankpruthii