pub enum ServerCachePreference {
None,
QueryMatters,
Full,
MaxAge(Duration),
}
Expand description
The preference for caching the item on the server.
This can be overridden by the cache-control
or kvarn-cache-control
headers.
Note: It’s only a preference. Disabling the cache in compile-time will
disable this behaviour. Some other factors also play a role, such as number of cached
Vary
responses on a page.
Variants§
None
Will not cache response
QueryMatters
Will cache response with query
Full
Query does not matter and will be discarded
MaxAge(Duration)
Sets a max age for the content.
Query will be discarded in cache, same as Self::Full
.
Implementations§
source§impl ServerCachePreference
impl ServerCachePreference
sourcepub fn cache(self, cache_action: CacheAction, method: &Method) -> bool
pub fn cache(self, cache_action: CacheAction, method: &Method) -> bool
If a response with cache_action
(from host::CacheAction
) should be cached.
sourcepub fn query_matters(self) -> bool
pub fn query_matters(self) -> bool
If query matters in cache.
Ultimately dictates which variant of UriKey
should be cached.
Trait Implementations§
source§impl Clone for ServerCachePreference
impl Clone for ServerCachePreference
source§fn clone(&self) -> ServerCachePreference
fn clone(&self) -> ServerCachePreference
Returns a copy 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 ServerCachePreference
impl Debug for ServerCachePreference
source§impl FromStr for ServerCachePreference
impl FromStr for ServerCachePreference
source§impl Hash for ServerCachePreference
impl Hash for ServerCachePreference
source§impl PartialEq for ServerCachePreference
impl PartialEq for ServerCachePreference
impl Copy for ServerCachePreference
impl Eq for ServerCachePreference
impl StructuralPartialEq for ServerCachePreference
Auto Trait Implementations§
impl Freeze for ServerCachePreference
impl RefUnwindSafe for ServerCachePreference
impl Send for ServerCachePreference
impl Sync for ServerCachePreference
impl Unpin for ServerCachePreference
impl UnwindSafe for ServerCachePreference
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more