pub struct TieredCacheConfig {
pub write_through_l1: bool,
pub write_through_l2: bool,
pub l1_ttl: Option<Duration>,
pub l2_ttl: Option<Duration>,
pub l1_required: bool,
pub l2_required: bool,
}Expand description
Configuration for tiered cache.
Fields§
§write_through_l1: boolWhether to write to L1 on L2 hit (write-through to L1).
write_through_l2: boolWhether to write to L2 on L1 write (write-through to L2).
l1_ttl: Option<Duration>L1 TTL (usually shorter than L2).
l2_ttl: Option<Duration>L2 TTL.
l1_required: boolWhether L1 failures should fail the operation.
l2_required: boolWhether L2 failures should fail the operation.
Implementations§
Source§impl TieredCacheConfig
impl TieredCacheConfig
Sourcepub fn with_l1_ttl(self, ttl: Duration) -> Self
pub fn with_l1_ttl(self, ttl: Duration) -> Self
Set L1 TTL.
Sourcepub fn with_l2_ttl(self, ttl: Duration) -> Self
pub fn with_l2_ttl(self, ttl: Duration) -> Self
Set L2 TTL.
Sourcepub fn require_l1(self) -> Self
pub fn require_l1(self) -> Self
Make L1 required.
Sourcepub fn require_l2(self) -> Self
pub fn require_l2(self) -> Self
Make L2 required.
Sourcepub fn no_write_l1(self) -> Self
pub fn no_write_l1(self) -> Self
Disable write-through to L1.
Sourcepub fn no_write_l2(self) -> Self
pub fn no_write_l2(self) -> Self
Disable write-through to L2.
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 · 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 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