Cache Stores
The reflection cache is partitioned into three independent stores — each holding a different reflection artifact. Every store is a thread-safe ConcurrentDictionary with its own size cap and eviction timeline.
The three stores
| Store | Key | Value | Purpose |
|---|---|---|---|
| TypeProperties | Type | Dictionary<string, PropertyInfo> | All public instance properties per type, keyed by property name for O(1) lookup. |
| PropertyPath | (Type, string) | string | Validated & normalized dotted property paths — e.g. "customer.address.city" → "Customer.Address.City". |
| CollectionElementType | Type | Type? | Element type for collection types — e.g. List<Order> → Order. null for non-collection types. |
Note
Each store is identifiable at runtime via the
CacheMemoryType enum: TypeProperties, PropertyPath, and CollectionElementType. Pass that value to ClearCache or IsCacheFull to target a single store.Targeting a specific store
using DynamicWhere.ex.Optimization.Cache.Source;
using DynamicWhere.ex.Optimization.Cache.Config;
// Clear only the validated-path store, leave property metadata intact
CacheExpose.ClearCache(CacheMemoryType.PropertyPath);
// Check if a single store has hit its cap
bool typesFull = CacheExpose.IsCacheFull(CacheMemoryType.TypeProperties);
bool pathsFull = CacheExpose.IsCacheFull(CacheMemoryType.PropertyPath);
bool collectionsFull = CacheExpose.IsCacheFull(CacheMemoryType.CollectionElementType);Sizing
All three stores share the same MaxCacheSize from your CacheOptions. With the default of 1000, each store independently holds up to 1000 entries — so the cache ceiling totals 3000 entries across the process. Increase or decrease this through a preset or a custom options object.
Entry lifetime
- Entries are added on first reflection miss for a given key.
- Entries record access (timestamp / hit count) on every read when LRU / LFU tracking is enabled.
- Entries are removed only when an eviction pass runs (automatic on overflow, or manual via
ForceEvictionOnAllCaches/ClearCache/ClearAllCaches).