pub struct LRU2<C: Cacheable> { /* private fields */ }
Expand description
The two-level LRU cache
Implementations§
Source§impl<C: Cacheable> Cache<C>
impl<C: Cacheable> Cache<C>
Sourcepub fn new(cache_size: usize, register_size: usize) -> Cache<C>
pub 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.
Sourcepub fn set(
&mut self,
upper_key: C::UpperKey,
lower_key: C::LowerKey,
payload: C::Payload,
) -> bool
pub fn set( &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.
Auto Trait Implementations§
impl<C> Freeze for Cache<C>
impl<C> RefUnwindSafe for Cache<C>where
<C as Cacheable>::UpperKey: RefUnwindSafe,
<C as Cacheable>::LowerKey: RefUnwindSafe,
<C as Cacheable>::Payload: RefUnwindSafe,
impl<C> !Send for Cache<C>
impl<C> !Sync for Cache<C>
impl<C> Unpin for Cache<C>
impl<C> UnwindSafe for Cache<C>where
<C as Cacheable>::UpperKey: RefUnwindSafe + UnwindSafe,
<C as Cacheable>::LowerKey: RefUnwindSafe + UnwindSafe,
<C as Cacheable>::Payload: RefUnwindSafe + 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