json-logic-java
json-logic-java copied to clipboard
Add a cache eviction policy for parseCache
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.