pub struct TieredCacheConfig {
pub enable_l1: bool,
pub enable_l2: bool,
pub write_through: bool,
pub promote_to_l1: bool,
pub l1_ttl_fraction: f64,
pub l1_promote_ttl: Option<Duration>,
}Expand description
Tiered cache configuration
Fields§
§enable_l1: boolEnable L1 cache
enable_l2: boolEnable L2 cache
write_through: boolWrite-through to L2 on L1 set
promote_to_l1: boolPromote L2 hits to L1
l1_ttl_fraction: f64L1 TTL multiplier (fraction of L2 TTL)
l1_promote_ttl: Option<Duration>Fixed TTL applied to entries promoted from L2 into L1 on a read hit.
§Policy
Deriving the promoted L1 TTL from the live remaining L2 TTL would
require an extra TTL round-trip to L2 on every promotion (the hot
read path). To avoid that per-read cost we instead apply this fixed
default. None means promoted entries are stored without expiry and
rely on L1 capacity/eviction. Defaults to 60s.
Note: the write path (set) still derives the L1 TTL as
l1_ttl_fraction * ttl because the TTL is already known there without
any extra round-trip.
Trait Implementations§
Source§impl Clone for TieredCacheConfig
impl Clone for TieredCacheConfig
Source§fn clone(&self) -> TieredCacheConfig
fn clone(&self) -> TieredCacheConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TieredCacheConfig
impl Debug for TieredCacheConfig
Auto Trait Implementations§
impl Freeze for TieredCacheConfig
impl RefUnwindSafe for TieredCacheConfig
impl Send for TieredCacheConfig
impl Sync for TieredCacheConfig
impl Unpin for TieredCacheConfig
impl UnsafeUnpin for TieredCacheConfig
impl UnwindSafe for TieredCacheConfig
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