pub struct VerifiedCache { /* private fields */ }Expand description
LRU cache for verified XorName values.
This cache stores XorName values that have been verified to exist on the
autonomi network, avoiding repeated network queries for the same data.
Implementations§
Source§impl VerifiedCache
impl VerifiedCache
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new cache with the specified capacity.
If capacity is 0, defaults to 1.
Sourcepub fn contains(&self, xorname: &XorName) -> bool
pub fn contains(&self, xorname: &XorName) -> bool
Check if a XorName is in the cache.
Returns true if the XorName is cached (verified to exist on autonomi).
Sourcepub fn insert(&self, xorname: XorName)
pub fn insert(&self, xorname: XorName)
Add a XorName to the cache.
This should be called after verifying that data exists on the autonomi network.
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get current cache statistics.
Trait Implementations§
Source§impl Clone for VerifiedCache
impl Clone for VerifiedCache
Source§fn clone(&self) -> VerifiedCache
fn clone(&self) -> VerifiedCache
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for VerifiedCache
impl !RefUnwindSafe for VerifiedCache
impl Send for VerifiedCache
impl Sync for VerifiedCache
impl Unpin for VerifiedCache
impl UnsafeUnpin for VerifiedCache
impl !UnwindSafe for VerifiedCache
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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