pub struct LfudaMeta {
pub frequency: u64,
pub age_at_insertion: u64,
}Expand description
Metadata for LFUDA (LFU with Dynamic Aging) cache entries.
LFUDA is similar to LFU but addresses the “aging problem” where old frequently-used items can prevent new items from being cached. The age factor is maintained at the cache level, not per-entry.
§Algorithm
Entry priority = frequency + age_at_insertion
- When an item is evicted, global_age = evicted_item.priority
- New items start with current global_age as their insertion age
§Examples
use cache_rs::meta::LfudaMeta;
let meta = LfudaMeta::new(1, 10); // frequency=1, age_at_insertion=10
assert_eq!(meta.frequency, 1);
assert_eq!(meta.age_at_insertion, 10);
assert_eq!(meta.priority(), 11);Fields§
§frequency: u64Access frequency count.
age_at_insertion: u64Age value when this item was inserted (snapshot of global_age).
Implementations§
Trait Implementations§
impl Copy for LfudaMeta
impl Eq for LfudaMeta
impl StructuralPartialEq for LfudaMeta
Auto Trait Implementations§
impl Freeze for LfudaMeta
impl RefUnwindSafe for LfudaMeta
impl Send for LfudaMeta
impl Sync for LfudaMeta
impl Unpin for LfudaMeta
impl UnwindSafe for LfudaMeta
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.