pub struct ChainCache { /* private fields */ }Expand description
LRU-like cache for resolved authority chains.
Implementations§
Source§impl ChainCache
impl ChainCache
Sourcepub fn with_capacity(max_entries: usize) -> Self
pub fn with_capacity(max_entries: usize) -> Self
Create a cache with a custom capacity.
Sourcepub fn get(
&mut self,
from: &Did,
to: &Did,
now: &Timestamp,
) -> Option<&AuthorityChain>
pub fn get( &mut self, from: &Did, to: &Did, now: &Timestamp, ) -> Option<&AuthorityChain>
Get a cached chain, updating access time.
Sourcepub fn insert(
&mut self,
from: &Did,
to: &Did,
chain: AuthorityChain,
now: &Timestamp,
)
pub fn insert( &mut self, from: &Did, to: &Did, chain: AuthorityChain, now: &Timestamp, )
Insert a chain into the cache.
Sourcepub fn invalidate(&mut self, did: &Did)
pub fn invalidate(&mut self, did: &Did)
Invalidate all chains involving a specific DID.
Trait Implementations§
Source§impl Debug for ChainCache
impl Debug for ChainCache
Auto Trait Implementations§
impl Freeze for ChainCache
impl RefUnwindSafe for ChainCache
impl Send for ChainCache
impl Sync for ChainCache
impl Unpin for ChainCache
impl UnsafeUnpin for ChainCache
impl UnwindSafe for ChainCache
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