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 expiry from.
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§
Trait Implementations§
Source§impl Debug for CacheExpiration
impl Debug for CacheExpiration
Source§impl From<Duration> for CacheExpiration
impl From<Duration> for CacheExpiration
Source§impl From<Instant> for CacheExpiration
impl From<Instant> for CacheExpiration
Auto Trait Implementations§
impl Freeze for CacheExpiration
impl RefUnwindSafe for CacheExpiration
impl Send for CacheExpiration
impl Sync for CacheExpiration
impl Unpin for CacheExpiration
impl UnwindSafe for CacheExpiration
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