pub enum CachePolicy {
Revalidate,
MaxAge(Duration),
CacheFirst,
NoCache,
}Expand description
How the cache should be consulted for a fetch.
Variants§
Revalidate
Default. Always revalidate with a conditional GET (If-None-Match /
If-Modified-Since); a 304 serves the cached body.
MaxAge(Duration)
Serve directly from cache without hitting the network if the cached entry is
younger than this duration; otherwise behave like CachePolicy::Revalidate.
CacheFirst
Serve the cached entry without any network call, regardless of age, if one
exists; only on a cache miss does it fetch (then behave like CachePolicy::Revalidate).
Used by item lookup (rss show / MCP get_item) so a rolled feed window cannot evict
an item the caller already saw. Exception to the always-revalidate default — see
ADR-0014.
NoCache
Ignore the cache entirely (do not read or write it).
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 moreimpl Copy for CachePolicy
Source§impl Debug for CachePolicy
impl Debug for CachePolicy
Source§impl Default for CachePolicy
impl Default for CachePolicy
Source§fn default() -> CachePolicy
fn default() -> CachePolicy
Returns the “default value” for a type. Read more
impl Eq for CachePolicy
Source§impl PartialEq for CachePolicy
impl PartialEq for CachePolicy
Source§fn eq(&self, other: &CachePolicy) -> bool
fn eq(&self, other: &CachePolicy) -> bool
Tests for
self and other values to be equal, and is used by ==.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.