Struct foyer::HybridCacheBuilderPhaseStorage
source · pub struct HybridCacheBuilderPhaseStorage<K, V, S>{ /* private fields */ }Expand description
Hybrid cache builder modify the disk cache configurations.
Implementations§
source§impl<K, V, S> HybridCacheBuilderPhaseStorage<K, V, S>
impl<K, V, S> HybridCacheBuilderPhaseStorage<K, V, S>
sourcepub fn with_device_config(self, device_config: impl Into<DeviceConfig>) -> Self
pub fn with_device_config(self, device_config: impl Into<DeviceConfig>) -> Self
Set device config for the disk cache store.
sourcepub fn with_flush(self, flush: bool) -> Self
pub fn with_flush(self, flush: bool) -> Self
Enable/disable sync after writes.
Default: false.
sourcepub fn with_indexer_shards(self, indexer_shards: usize) -> Self
pub fn with_indexer_shards(self, indexer_shards: usize) -> Self
Set the shard num of the indexer. Each shard has its own lock.
Default: 64.
sourcepub fn with_recover_mode(self, recover_mode: RecoverMode) -> Self
pub fn with_recover_mode(self, recover_mode: RecoverMode) -> Self
Set the recover mode for the disk cache store.
See more in RecoverMode.
Default: RecoverMode::Quiet.
sourcepub fn with_recover_concurrency(self, recover_concurrency: usize) -> Self
pub fn with_recover_concurrency(self, recover_concurrency: usize) -> Self
Set the recover concurrency for the disk cache store.
Default: 8.
sourcepub fn with_flushers(self, flushers: usize) -> Self
pub fn with_flushers(self, flushers: usize) -> Self
Set the flusher count for the disk cache store.
The flusher count limits how many regions can be concurrently written.
Default: 1.
sourcepub fn with_reclaimers(self, reclaimers: usize) -> Self
pub fn with_reclaimers(self, reclaimers: usize) -> Self
Set the reclaimer count for the disk cache store.
The reclaimer count limits how many regions can be concurrently reclaimed.
Default: 1.
sourcepub fn with_buffer_threshold(self, threshold: usize) -> Self
👎Deprecated since 0.11.4: The function will be renamed to “with_buffer_pool_size()”, use it instead.
pub fn with_buffer_threshold(self, threshold: usize) -> Self
Set the total flush buffer threshold.
Each flusher shares a volume at threshold / flushers.
If the buffer of the flush queue exceeds the threshold, the further entries will be ignored.
Default: 16 MiB.
sourcepub fn with_buffer_pool_size(self, buffer_pool_size: usize) -> Self
pub fn with_buffer_pool_size(self, buffer_pool_size: usize) -> Self
Set the total flush buffer pool size.
Each flusher shares a volume at threshold / flushers.
If the buffer of the flush queue exceeds the threshold, the further entries will be ignored.
Default: 16 MiB.
sourcepub fn with_clean_region_threshold(self, clean_region_threshold: usize) -> Self
pub fn with_clean_region_threshold(self, clean_region_threshold: usize) -> Self
Set the clean region threshold for the disk cache store.
The reclaimers only work when the clean region count is equal to or lower than the clean region threshold.
Default: the same value as the reclaimers.
sourcepub fn with_eviction_pickers(
self,
eviction_pickers: Vec<Box<dyn EvictionPicker>>,
) -> Self
pub fn with_eviction_pickers( self, eviction_pickers: Vec<Box<dyn EvictionPicker>>, ) -> Self
Set the eviction pickers for th disk cache store.
The eviction picker is used to pick the region to reclaim.
The eviction pickers are applied in order. If the previous eviction picker doesn’t pick any region, the next one will be applied.
If no eviction picker picks a region, a region will be picked randomly.
Default: [ invalid ratio picker { threshold = 0.8 }, fifo picker ]
sourcepub fn with_admission_picker(
self,
admission_picker: Arc<dyn AdmissionPicker<Key = K>>,
) -> Self
pub fn with_admission_picker( self, admission_picker: Arc<dyn AdmissionPicker<Key = K>>, ) -> Self
Set the admission pickers for th disk cache store.
The admission picker is used to pick the entries that can be inserted into the disk cache store.
Default: [AdmitAllPicker].
sourcepub fn with_reinsertion_picker(
self,
reinsertion_picker: Arc<dyn ReinsertionPicker<Key = K>>,
) -> Self
pub fn with_reinsertion_picker( self, reinsertion_picker: Arc<dyn ReinsertionPicker<Key = K>>, ) -> Self
Set the reinsertion pickers for th disk cache store.
The reinsertion picker is used to pick the entries that can be reinsertion into the disk cache store while reclaiming.
Note: Only extremely important entries should be picked. If too many entries are picked, both insertion and reinsertion will be stuck.
Default: [RejectAllPicker].
sourcepub fn with_compression(self, compression: Compression) -> Self
pub fn with_compression(self, compression: Compression) -> Self
Set the compression algorithm of the disk cache store.
Default: Compression::None.
sourcepub fn with_tombstone_log_config(
self,
tombstone_log_config: TombstoneLogConfig,
) -> Self
pub fn with_tombstone_log_config( self, tombstone_log_config: TombstoneLogConfig, ) -> Self
Enable the tombstone log with the given config.
For updatable cache, either the tombstone log or RecoverMode::None must be enabled to prevent from the
phantom entries after reopen.
sourcepub fn with_runtime_config(self, runtime_config: RuntimeConfig) -> Self
pub fn with_runtime_config(self, runtime_config: RuntimeConfig) -> Self
Configure the dedicated runtime for the disk cache store.
sourcepub async fn build(self) -> Result<HybridCache<K, V, S>>
pub async fn build(self) -> Result<HybridCache<K, V, S>>
Build and open the hybrid cache with the given configurations.
Auto Trait Implementations§
impl<K, V, S> !Freeze for HybridCacheBuilderPhaseStorage<K, V, S>
impl<K, V, S> !RefUnwindSafe for HybridCacheBuilderPhaseStorage<K, V, S>
impl<K, V, S> Send for HybridCacheBuilderPhaseStorage<K, V, S>
impl<K, V, S> Sync for HybridCacheBuilderPhaseStorage<K, V, S>
impl<K, V, S> Unpin for HybridCacheBuilderPhaseStorage<K, V, S>
impl<K, V, S> !UnwindSafe for HybridCacheBuilderPhaseStorage<K, V, S>
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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