pub struct EvalCache { /* private fields */ }Expand description
Zero-copy cache store With parallel feature: Uses DashMap for thread-safe concurrent access Without parallel feature: Uses HashMap + RefCell for ultra-fast single-threaded access Values are stored behind Arc to enable cheap cloning
Implementations§
Source§impl EvalCache
impl EvalCache
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create cache with preallocated capacity
Sourcepub fn get(&self, key: &CacheKey) -> Option<Arc<Value>>
pub fn get(&self, key: &CacheKey) -> Option<Arc<Value>>
Get cached result (zero-copy via Arc clone) Returns None if not cached Ultra-fast single-threaded access
Sourcepub fn insert(&self, key: CacheKey, value: Value)
pub fn insert(&self, key: CacheKey, value: Value)
Insert result into cache (wraps in Arc for zero-copy sharing) Ultra-fast single-threaded access
Sourcepub fn insert_arc(&self, key: CacheKey, value: Arc<Value>)
pub fn insert_arc(&self, key: CacheKey, value: Arc<Value>)
Insert with Arc-wrapped value (zero-copy if already Arc) Ultra-fast single-threaded access
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Sourcepub fn retain<F>(&self, predicate: F)
pub fn retain<F>(&self, predicate: F)
Remove entries based on a predicate function Predicate returns true to keep the entry, false to remove it
Sourcepub fn invalidate_dependencies(&self, changed_paths: &[String])
pub fn invalidate_dependencies(&self, changed_paths: &[String])
Invalidate cache entries that depend on changed paths Efficiently removes only affected entries