pub struct Ref<K, V>{ /* private fields */ }Expand description
A guarded pointer to a cache Entry.
EntryRef provides safe access to an entry stored in the Clock cache.
It binds the entry’s memory location to an epoch Guard, ensuring the
entry is not reclaimed by the cache’s eviction policy while this
handle exists.
Because it acts as a smart pointer to the Entry container rather than the value itself, it provides methods to access both the key and the value.
Implementations§
Methods from Deref<Target = Entry<K, V>>§
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Checks if the entry has passed its expiration deadline.
Returns true if expired_at is a time in the past relative to Instant::now.
If no expiration was set, this always returns false.
§Examples
use std::time::{Duration, Instant};
use omega_cache::core::entry::Entry;
// Entry that expired 1 second ago
let past = Instant::now() - Duration::from_secs(1);
let entry = Entry::new("key", "value", Some(past));
assert!(entry.is_expired());Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for Ref<K, V>
impl<K, V> !RefUnwindSafe for Ref<K, V>
impl<K, V> !Send for Ref<K, V>
impl<K, V> !Sync for Ref<K, V>
impl<K, V> Unpin for Ref<K, V>
impl<K, V> UnsafeUnpin for Ref<K, V>
impl<K, V> !UnwindSafe for Ref<K, V>
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