Struct retainer::entry::CacheExpiration
source · [−]pub struct CacheExpiration { /* private fields */ }
Expand description
Small structure to represent expiration in a cache.
Expirations are constructed using the From
and Into
traits
from the standard library; there are no other functions.
There are currently several supported conversions:
u64
-> a number of milliseconds to pass before an entry should expire.Instant
-> an exact time that an entry should expire.Duration
-> a duration to pass before an entry should expire.Range<u64>
-> a random range of milliseconds to sample from to determine when an entry should expire.
Other conversions may be added in future, but this should suffice for most cases. Any of these types may be passed to the insertion methods on a cache type when adding entries to a cache.
Implementations
sourceimpl CacheExpiration
impl CacheExpiration
Trait Implementations
sourceimpl Debug for CacheExpiration
impl Debug for CacheExpiration
sourceimpl From<Duration> for CacheExpiration
impl From<Duration> for CacheExpiration
sourceimpl From<Instant> for CacheExpiration
impl From<Instant> for CacheExpiration
sourceimpl From<Range<u64>> for CacheExpiration
impl From<Range<u64>> for CacheExpiration
Auto Trait Implementations
impl RefUnwindSafe for CacheExpiration
impl Send for CacheExpiration
impl Sync for CacheExpiration
impl Unpin for CacheExpiration
impl UnwindSafe for CacheExpiration
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more