pub struct CacheEntry<V> { /* private fields */ }Expand description
缓存条目
Implementations§
Source§impl<V> CacheEntry<V>
impl<V> CacheEntry<V>
Sourcepub fn into_value(self) -> V
pub fn into_value(self) -> V
取出值
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
检查是否已过期
Sourcepub fn remaining_ttl(&self) -> Option<Duration>
pub fn remaining_ttl(&self) -> Option<Duration>
获取剩余 TTL
Sourcepub fn last_accessed(&self) -> Instant
pub fn last_accessed(&self) -> Instant
获取最后访问时间
Sourcepub fn created_at(&self) -> Instant
pub fn created_at(&self) -> Instant
获取创建时间
Sourcepub fn access_count(&self) -> u64
pub fn access_count(&self) -> u64
获取访问次数
Sourcepub fn extend_ttl(&mut self, duration: Duration)
pub fn extend_ttl(&mut self, duration: Duration)
延长 TTL
Trait Implementations§
Source§impl<V: Clone> Clone for CacheEntry<V>
impl<V: Clone> Clone for CacheEntry<V>
Source§fn clone(&self) -> CacheEntry<V>
fn clone(&self) -> CacheEntry<V>
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<V> Freeze for CacheEntry<V>where
V: Freeze,
impl<V> RefUnwindSafe for CacheEntry<V>where
V: RefUnwindSafe,
impl<V> Send for CacheEntry<V>where
V: Send,
impl<V> Sync for CacheEntry<V>where
V: Sync,
impl<V> Unpin for CacheEntry<V>where
V: Unpin,
impl<V> UnwindSafe for CacheEntry<V>where
V: UnwindSafe,
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