Struct foyer::HybridCacheBuilderPhaseMemory
source · pub struct HybridCacheBuilderPhaseMemory<K, V, S>{ /* private fields */ }Expand description
Hybrid cache builder to modify the in-memory cache configurations.
Implementations§
source§impl<K, V, S> HybridCacheBuilderPhaseMemory<K, V, S>
impl<K, V, S> HybridCacheBuilderPhaseMemory<K, V, S>
sourcepub fn with_shards(self, shards: usize) -> Self
pub fn with_shards(self, shards: usize) -> Self
Set in-memory cache sharding count. Entries will be distributed to different shards based on their hash. Operations on different shard can be parallelized.
sourcepub fn with_eviction_config(
self,
eviction_config: impl Into<EvictionConfig>,
) -> Self
pub fn with_eviction_config( self, eviction_config: impl Into<EvictionConfig>, ) -> Self
Set in-memory cache eviction algorithm.
The default value is a general-used w-TinyLFU algorithm.
sourcepub fn with_object_pool_capacity(self, object_pool_capacity: usize) -> Self
pub fn with_object_pool_capacity(self, object_pool_capacity: usize) -> Self
Set object pool for handles. The object pool is used to reduce handle allocation.
The optimized value is supposed to be equal to the max cache entry count.
The default value is 1024.
sourcepub fn with_hash_builder<OS>(
self,
hash_builder: OS,
) -> HybridCacheBuilderPhaseMemory<K, V, OS>where
OS: HashBuilder + Debug,
pub fn with_hash_builder<OS>(
self,
hash_builder: OS,
) -> HybridCacheBuilderPhaseMemory<K, V, OS>where
OS: HashBuilder + Debug,
Set in-memory cache hash builder.
sourcepub fn with_weighter(self, weighter: impl Weighter<K, V>) -> Self
pub fn with_weighter(self, weighter: impl Weighter<K, V>) -> Self
Set in-memory cache weighter.
sourcepub fn storage(self) -> HybridCacheBuilderPhaseStorage<K, V, S>
pub fn storage(self) -> HybridCacheBuilderPhaseStorage<K, V, S>
Continue to modify the in-memory cache configurations.
Auto Trait Implementations§
impl<K, V, S> !Freeze for HybridCacheBuilderPhaseMemory<K, V, S>
impl<K, V, S> !RefUnwindSafe for HybridCacheBuilderPhaseMemory<K, V, S>
impl<K, V, S> Send for HybridCacheBuilderPhaseMemory<K, V, S>
impl<K, V, S> Sync for HybridCacheBuilderPhaseMemory<K, V, S>
impl<K, V, S> Unpin for HybridCacheBuilderPhaseMemory<K, V, S>where
S: Unpin,
impl<K, V, S> !UnwindSafe for HybridCacheBuilderPhaseMemory<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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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