High-performance cache policies and supporting data structures.
Bucketed LFU keeps entries grouped by frequency, with O(1) promotion and O(1) eviction using min_freq.
Generalized DS:
EntryId)freq, an intrusive list of entry ids (usually LRU within the bucket)entries: Vec<Option<EntryMeta>>index: HashMap<K, EntryId>buckets: HashMap<u64, BucketMeta>min_freq: u64Where BucketMeta holds:
list_head/list_tail (intrusive list of EntryId)prev/next links between buckets to skip empty buckets quicklytouch(id)id from freq bucket list.freq.min_freq, advance min_freq.evict()min_freq bucket tail (LRU tie-break).prev/next) is one approach; scanning is another (but can become O(n)).u64 counts can grow without bound; aging/decay is a separate concern).