pub struct RenderOutputCache<K>{ /* private fields */ }Expand description
Byte-weighted cache for RenderOutput values
Unlike entry-count caches, this tracks actual memory usage. A 4MB emoji bitmap consumes 4000x more quota than a 1KB glyph.
Implementations§
Source§impl<K> RenderOutputCache<K>
impl<K> RenderOutputCache<K>
Sourcepub fn with_default_limit() -> Self
pub fn with_default_limit() -> Self
Create a cache with the default byte limit (512 MB or env override).
Sourcepub fn get(&self, key: &K) -> Option<RenderOutput>
pub fn get(&self, key: &K) -> Option<RenderOutput>
Look up a cached render output.
Sourcepub fn insert(&self, key: K, value: RenderOutput)
pub fn insert(&self, key: K, value: RenderOutput)
Store a render output in the cache.
Large outputs may be rejected by TinyLFU if not accessed frequently.
Sourcepub fn weighted_size(&self) -> u64
pub fn weighted_size(&self) -> u64
Current weighted size in bytes.
Sourcepub fn entry_count(&self) -> u64
pub fn entry_count(&self) -> u64
Number of entries in cache.
Sourcepub fn metrics(&self) -> CacheMetrics
pub fn metrics(&self) -> CacheMetrics
Performance metrics.
Trait Implementations§
Auto Trait Implementations§
impl<K> Freeze for RenderOutputCache<K>
impl<K> !RefUnwindSafe for RenderOutputCache<K>
impl<K> Send for RenderOutputCache<K>
impl<K> Sync for RenderOutputCache<K>
impl<K> Unpin for RenderOutputCache<K>
impl<K> UnsafeUnpin for RenderOutputCache<K>
impl<K> !UnwindSafe for RenderOutputCache<K>
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