pub struct LRUCache { /* private fields */ }
Expand description
Least Recently Used (LRU) cache, with one slot for every possible block, each protected by a
RwLock
.
Trait Implementations§
Source§impl<E> DataBlockCache<E> for LRUCache
impl<E> DataBlockCache<E> for LRUCache
Source§fn new(
capacity_mb: u64,
block_size: u64,
total_size: u64,
) -> Result<Self, CacheError<E>>
fn new( capacity_mb: u64, block_size: u64, total_size: u64, ) -> Result<Self, CacheError<E>>
Create a new block cache with given maximal capacity, block size, and cumulative size of all
blocks.
Source§fn get<'life0, 'async_trait>(
&'life0 self,
pos: u64,
) -> Pin<Box<dyn Future<Output = Option<RwLockReadGuard<'_, Block>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 self,
pos: u64,
) -> Pin<Box<dyn Future<Output = Option<RwLockReadGuard<'_, Block>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the block at a position.
Source§fn insert_lock<'life0, 'async_trait, A>(
&'life0 self,
pos: u64,
f: impl 'async_trait + Future<Output = Result<A, E>> + Send,
) -> Pin<Box<dyn Future<Output = Result<RwLockReadGuard<'_, Block>, CacheError<E>>> + Send + 'async_trait>>
fn insert_lock<'life0, 'async_trait, A>( &'life0 self, pos: u64, f: impl 'async_trait + Future<Output = Result<A, E>> + Send, ) -> Pin<Box<dyn Future<Output = Result<RwLockReadGuard<'_, Block>, CacheError<E>>> + Send + 'async_trait>>
Insert a block at a position, locking until the output is ready.
Source§fn stats(&self) -> &CacheStats
fn stats(&self) -> &CacheStats
Caching statistics.
Auto Trait Implementations§
impl !Freeze for LRUCache
impl !RefUnwindSafe for LRUCache
impl Send for LRUCache
impl Sync for LRUCache
impl Unpin for LRUCache
impl !UnwindSafe for LRUCache
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