Struct lsm_tree::BlockCache
source · pub struct BlockCache { /* private fields */ }
Expand description
Block cache, in which blocks are cached in-memory after being retrieved from disk
This speeds up consecutive queries to nearby data, improving read performance for hot data.
§Examples
Sharing block cache between multiple trees
// Provide 40 MB of cache capacity
let block_cache = Arc::new(BlockCache::with_capacity_bytes(40 * 1_000 * 1_000));
let tree1 = Config::new(folder).block_cache(block_cache.clone()).open()?;
let tree2 = Config::new(folder).block_cache(block_cache.clone()).open()?;
Implementations§
source§impl BlockCache
impl BlockCache
sourcepub fn with_capacity_bytes(bytes: u64) -> Self
pub fn with_capacity_bytes(bytes: u64) -> Self
Creates a new block cache with roughly n
bytes of capacity
Auto Trait Implementations§
impl Freeze for BlockCache
impl RefUnwindSafe for BlockCache
impl Send for BlockCache
impl Sync for BlockCache
impl Unpin for BlockCache
impl UnwindSafe for BlockCache
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