pub struct Cache { /* private fields */ }Expand description
Cache, in which blocks or blobs 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 cache between multiple trees
// Provide 64 MB of cache capacity
let cache = Arc::new(Cache::with_capacity_bytes(64 * 1_000 * 1_000));
let tree1 = Config::new(folder, Default::default(), Default::default()).use_cache(cache.clone()).open()?;
let tree2 = Config::new(folder, Default::default(), Default::default()).use_cache(cache.clone()).open()?;Implementations§
Source§impl Cache
impl Cache
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.
Sourcepub fn with_row_cache(self, enabled: bool) -> Self
pub fn with_row_cache(self, enabled: bool) -> Self
Enables or disables the row cache (decoded point-read results), returning the cache for builder-style configuration. Off by default; rows share the block cache’s byte capacity when enabled.
Sourcepub fn row_cache_enabled(&self) -> bool
pub fn row_cache_enabled(&self) -> bool
Whether the row cache is enabled (see Cache::with_row_cache).
Sourcepub fn with_metadata_priority(self, enabled: bool) -> Self
pub fn with_metadata_priority(self, enabled: bool) -> Self
Enables or disables high-priority pinning of index / filter /
range-tombstone blocks (see Cache::metadata_priority field docs),
returning the cache for builder-style configuration. On by default.
Sourcepub fn metadata_priority(&self) -> bool
pub fn metadata_priority(&self) -> bool
Whether metadata-block priority pinning is enabled (see
Cache::with_metadata_priority).
Auto Trait Implementations§
impl !RefUnwindSafe for Cache
impl Freeze for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnsafeUnpin for Cache
impl UnwindSafe for Cache
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more