CacheOptions
CacheOptions is the single configuration object for the reflection cache. Every tunable lives here — size caps, eviction algorithm, tracking toggles, and the auto-validation safety net.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
MaxCacheSize | int | 1000 | Maximum number of entries each store will hold before an eviction pass runs. |
LeastUsedThreshold | int | 25 | Percentage of entries to remove on a single eviction pass — the "least valuable" slice. |
MostUsedThreshold | int | 75 | Percentage of entries to keep — always equal to 100 − LeastUsedThreshold. |
EvictionStrategy | CacheEvictionStrategy | LRU | Algorithm used to pick the least-valuable entries: FIFO, LRU, or LFU. |
EnableLruTracking | bool | true | Tracks per-entry access timestamps. Auto-managed based on EvictionStrategy. |
EnableLfuTracking | bool | false | Tracks per-entry hit counters. Auto-managed based on EvictionStrategy. |
AutoValidateConfiguration | bool | true | Auto-corrects mismatched settings — e.g. enables EnableLfuTracking when EvictionStrategy = LFU. |
Note
LeastUsedThreshold and MostUsedThreshold always sum to 100. Setting one updates the other when AutoValidateConfiguration is on (the default).Defaults in code
The default options object is equivalent to CacheOptions.Default:
var defaults = new CacheOptions
{
MaxCacheSize = 1000,
LeastUsedThreshold = 25,
MostUsedThreshold = 75,
EvictionStrategy = CacheEvictionStrategy.LRU,
EnableLruTracking = true,
EnableLfuTracking = false,
AutoValidateConfiguration = true,
};Strategy ↔ tracking matrix
When AutoValidateConfiguration is on, the two tracking flags are kept consistent with EvictionStrategy so that you never run an LFU eviction over zero hit counters.
| EvictionStrategy | EnableLruTracking | EnableLfuTracking |
|---|---|---|
FIFO | false | false |
LRU | true | false |
LFU | false | true |