RulePlanCache
final class RulePlanCache
Worker-lifetime LRU cache of compiled rule plans.
Plans are keyed by string rules or structured rules containing only scalar values. Plans are pure data — safe to cache across requests. A cached null-equivalent (un-cacheable) is represented by returning null from get(), not stored.
Bounded by $maxSize with LRU eviction. Typical apps have <1000 unique rules; the cap prevents pathological growth in apps that dynamically generate rules.
Constants
| private DEFAULT_MAX_SIZE |
|
Methods
Get a cached plan for the given rule array.
Set the maximum cache size.
Flush all static state.
Details
at line 47
static AttributePlan|null
get(array $rules)
Get a cached plan for the given rule array.
Return null for rules with executable or non-scalar state, or when no plan exists.
at line 69
static void
put(array $rules, AttributePlan $plan)
Store a compiled plan in the cache.
at line 100
static void
setMaxSize(int $size)
Set the maximum cache size.
The cache size persists in a static property for the worker lifetime and affects every subsequent validation rule plan cache write.
at line 140
static void
flushState()
Flush all static state.