pub struct CachePolicy {
pub enabled: bool,
pub ttl: Option<Duration>,
pub tier_hint: Option<CacheTier>,
pub bypass: bool,
pub invalidation_hint: Option<InvalidationHint>,
}Expand description
Policy controlling how a Query result is cached. Carried in
Context and optionally overridden on Query.cache_policy.
Fields§
§enabled: boolIf false, do not read from or write to any cache tier.
ttl: Option<Duration>Explicit time-to-live; None means ‘defer to tier default’.
tier_hint: Option<CacheTier>Preferred tier for this query; None means ‘tier decides’.
bypass: boolIf true, skip cache read but still write-through on miss.
invalidation_hint: Option<InvalidationHint>Optional hint to the cache about when to invalidate.
Implementations§
Source§impl CachePolicy
impl CachePolicy
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a default policy: enabled, no TTL, no tier hint, no bypass, no invalidation hint.
Sourcepub fn with_bypass(self, bypass: bool) -> Self
pub fn with_bypass(self, bypass: bool) -> Self
Set the bypass flag.
Trait Implementations§
Source§impl Clone for CachePolicy
impl Clone for CachePolicy
Source§fn clone(&self) -> CachePolicy
fn clone(&self) -> CachePolicy
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 CachePolicy
impl Debug for CachePolicy
Source§impl Default for CachePolicy
impl Default for CachePolicy
Source§impl<'de> Deserialize<'de> for CachePolicy
impl<'de> Deserialize<'de> for CachePolicy
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
Source§impl PartialEq for CachePolicy
impl PartialEq for CachePolicy
Source§impl Serialize for CachePolicy
impl Serialize for CachePolicy
impl StructuralPartialEq for CachePolicy
Auto Trait Implementations§
impl Freeze for CachePolicy
impl RefUnwindSafe for CachePolicy
impl Send for CachePolicy
impl Sync for CachePolicy
impl Unpin for CachePolicy
impl UnsafeUnpin for CachePolicy
impl UnwindSafe for CachePolicy
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