Struct lru2::LRU2
[−]
[src]
pub struct LRU2<C: Cacheable> { /* fields omitted */ }
The two-level LRU cache
Methods
impl<C: Cacheable> Cache<C>
[src]
fn new(cache_size: usize, register_size: usize) -> Cache<C>
Create a new LRU cache of caches
cache_size
specifies the number of caches in the second layer.
register_size
specifies the number of entries in each second-layer cache.
fn set(
&mut self,
upper_key: C::UpperKey,
lower_key: C::LowerKey,
payload: C::Payload
) -> bool
&mut self,
upper_key: C::UpperKey,
lower_key: C::LowerKey,
payload: C::Payload
) -> bool
Set a payload beneath two keys
The cache_key
is more general, and can have multiple register_keys
stored under it.
fn has(&mut self, upper_key: C::UpperKey) -> Option<usize>
Check if any payloads are set under a given cache_key
, and return the number of payloads set
fn get(
&mut self,
upper_key: C::UpperKey,
lower_key: C::LowerKey
) -> Option<&C::Payload>
&mut self,
upper_key: C::UpperKey,
lower_key: C::LowerKey
) -> Option<&C::Payload>
Get a payload set (if any) under a given set of keys