pub struct NodeCache { /* private fields */ }Expand description
A cache for graph node outputs.
Implementations§
Source§impl NodeCache
impl NodeCache
Sourcepub fn new(max_memory: usize, policy: EvictionPolicy) -> Self
pub fn new(max_memory: usize, policy: EvictionPolicy) -> Self
Create a new node cache with a given memory budget and eviction policy.
Sourcepub fn insert(&mut self, key: CacheKey, data: Vec<u8>)
pub fn insert(&mut self, key: CacheKey, data: Vec<u8>)
Insert data into the cache.
May evict existing entries if the memory budget is exceeded.
Sourcepub fn contains(&self, key: &CacheKey) -> bool
pub fn contains(&self, key: &CacheKey) -> bool
Check if a key is present without updating access stats.
Sourcepub fn invalidate(&mut self, key: &CacheKey) -> bool
pub fn invalidate(&mut self, key: &CacheKey) -> bool
Remove a specific key from the cache.
Sourcepub fn invalidate_node(&mut self, node_id: u64)
pub fn invalidate_node(&mut self, node_id: u64)
Invalidate all entries for a given node.
Sourcepub fn memory_usage(&self) -> usize
pub fn memory_usage(&self) -> usize
Current memory usage.
Sourcepub fn statistics(&self) -> &CacheStatistics
pub fn statistics(&self) -> &CacheStatistics
Get cache statistics.
Auto Trait Implementations§
impl Freeze for NodeCache
impl RefUnwindSafe for NodeCache
impl Send for NodeCache
impl Sync for NodeCache
impl Unpin for NodeCache
impl UnsafeUnpin for NodeCache
impl UnwindSafe for NodeCache
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more