pub struct SecureCache<Value> { /* private fields */ }Expand description
Bounded LRU cache with explicit TTL and authority-generation binding.
Implementations§
Source§impl<Value> SecureCache<Value>
impl<Value> SecureCache<Value>
Sourcepub fn new(limits: CacheLimits) -> Result<Self, CacheError>
pub fn new(limits: CacheLimits) -> Result<Self, CacheError>
Create an empty cache after validating all bounds.
Sourcepub fn insert(
&mut self,
key: CacheKey,
value: Value,
admission: CacheAdmission,
) -> Result<(), CacheError>
pub fn insert( &mut self, key: CacheKey, value: Value, admission: CacheAdmission, ) -> Result<(), CacheError>
Insert one positive or authenticated-negative result.
value_bytes is the caller’s conservative encoded/in-memory estimate.
Sourcepub fn get(
&mut self,
key: &CacheKey,
generation: CacheGeneration,
now: u64,
) -> Result<Option<(&Value, CacheDisposition)>, CacheError>
pub fn get( &mut self, key: &CacheKey, generation: CacheGeneration, now: u64, ) -> Result<Option<(&Value, CacheDisposition)>, CacheError>
Read one current entry and update its LRU position.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Remove every entry on a generation, policy, or chain-anchor transition.
Sourcepub const fn stats(&self) -> CacheStats
pub const fn stats(&self) -> CacheStats
Name-free counters.
Sourcepub const fn limits(&self) -> CacheLimits
pub const fn limits(&self) -> CacheLimits
Configured hard bounds.
Trait Implementations§
Source§impl<Value: Clone> Clone for SecureCache<Value>
impl<Value: Clone> Clone for SecureCache<Value>
Auto Trait Implementations§
impl<Value> Freeze for SecureCache<Value>
impl<Value> RefUnwindSafe for SecureCache<Value>
impl<Value> Send for SecureCache<Value>
impl<Value> Sync for SecureCache<Value>
impl<Value> Unpin for SecureCache<Value>
impl<Value> UnsafeUnpin for SecureCache<Value>
impl<Value> UnwindSafe for SecureCache<Value>
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