pub struct CacheConfig {
pub max_entries_per_key: usize,
pub max_total_entries: usize,
pub eviction_policy: EvictionPolicy,
pub persistence: PersistenceConfig,
pub default_ttl: Option<Duration>,
}Expand description
Cache configuration
Fields§
§max_entries_per_key: usizeMaximum number of entries per key
max_total_entries: usizeMaximum total number of entries
eviction_policy: EvictionPolicyEviction policy to use
persistence: PersistenceConfigPersistence configuration
default_ttl: Option<Duration>Default TTL for entries (if not specified per-entry)
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub fn with_max_entries_per_key(self, max: usize) -> Self
pub fn with_max_entries_per_key(self, max: usize) -> Self
Set maximum entries per key
Sourcepub fn with_max_total_entries(self, max: usize) -> Self
pub fn with_max_total_entries(self, max: usize) -> Self
Set maximum total entries
Sourcepub fn with_eviction_policy(self, policy: EvictionPolicy) -> Self
pub fn with_eviction_policy(self, policy: EvictionPolicy) -> Self
Set eviction policy
Sourcepub fn with_persistence(self, persistence: PersistenceConfig) -> Self
pub fn with_persistence(self, persistence: PersistenceConfig) -> Self
Set persistence configuration
Sourcepub fn with_default_ttl(self, ttl: Duration) -> Self
pub fn with_default_ttl(self, ttl: Duration) -> Self
Set default TTL for entries
Trait Implementations§
Source§impl Clone for CacheConfig
impl Clone for CacheConfig
Source§fn clone(&self) -> CacheConfig
fn clone(&self) -> CacheConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CacheConfig
impl Debug for CacheConfig
Source§impl Default for CacheConfig
impl Default for CacheConfig
Source§impl<'de> Deserialize<'de> for CacheConfig
impl<'de> Deserialize<'de> for CacheConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CacheConfig
impl RefUnwindSafe for CacheConfig
impl Send for CacheConfig
impl Sync for CacheConfig
impl Unpin for CacheConfig
impl UnsafeUnpin for CacheConfig
impl UnwindSafe for CacheConfig
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