polix.optimized.cache
Cache for compiled policy evaluators.
Caches compiled policies by their constraint set hash to avoid regenerating evaluators for equivalent policies.
On the JVM, uses an LRU cache with LinkedHashMap. In ClojureScript, uses a simple atom-based cache with size limit.
cache-stats
(cache-stats)Returns cache statistics.
clear-cache!
(clear-cache!)Clears the compiled policy cache.
Useful for testing or when operator definitions change significantly.
compile-cached
(compile-cached constraint-set)(compile-cached constraint-set opts)Compiles a constraint set, using cache if available.
This is the main entry point for cached compilation. Returns a compiled policy, either from cache or freshly compiled.
get-cached
(get-cached constraint-set)Returns a cached compiled policy, or nil if not cached.
put-cached
(put-cached constraint-set compiled)Caches a compiled policy.
warm-cache!
(warm-cache! constraint-sets)Pre-compiles and caches a collection of constraint sets.
Use this to warm up the cache with commonly-used policies at application startup.