pub struct ShapingCache { /* private fields */ }Expand description
Cache for shaping results
Uses a two-level cache (L1 hot cache + L2 LRU cache) for optimal performance across different access patterns.
Implementations§
Source§impl ShapingCache
impl ShapingCache
Sourcepub fn new() -> ShapingCache
pub fn new() -> ShapingCache
Create a new shaping cache with default capacities
L1 (hot cache): 100 entries for frequently accessed results L2 (LRU cache): 500 entries for less frequent access
Sourcepub fn with_capacity(l1_size: usize, l2_size: usize) -> ShapingCache
pub fn with_capacity(l1_size: usize, l2_size: usize) -> ShapingCache
Create a shaping cache with custom capacities
Sourcepub fn get(&self, key: &ShapingCacheKey) -> Option<ShapingResult>
pub fn get(&self, key: &ShapingCacheKey) -> Option<ShapingResult>
Get a cached shaping result
Returns Some(result) if the key exists in either cache level,
None if not found or if caching is globally disabled.
Sourcepub fn insert(&self, key: ShapingCacheKey, result: ShapingResult)
pub fn insert(&self, key: ShapingCacheKey, result: ShapingResult)
Insert a shaping result into the cache
The result is stored in both L1 and L2 caches for maximum availability. Does nothing if caching is globally disabled.
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Trait Implementations§
Source§impl Debug for ShapingCache
impl Debug for ShapingCache
Source§impl Default for ShapingCache
impl Default for ShapingCache
Source§fn default() -> ShapingCache
fn default() -> ShapingCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ShapingCache
impl !RefUnwindSafe for ShapingCache
impl Send for ShapingCache
impl Sync for ShapingCache
impl Unpin for ShapingCache
impl UnsafeUnpin for ShapingCache
impl !UnwindSafe for ShapingCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more