Enum kvarn::comprash::ServerCachePreference
source · 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<ServerCachePreference> for ServerCachePreference
impl PartialEq<ServerCachePreference> for ServerCachePreference
source§fn eq(&self, other: &ServerCachePreference) -> bool
fn eq(&self, other: &ServerCachePreference) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for ServerCachePreference
impl Eq for ServerCachePreference
impl StructuralEq for ServerCachePreference
impl StructuralPartialEq for ServerCachePreference
Auto Trait Implementations§
impl RefUnwindSafe for ServerCachePreference
impl Send for ServerCachePreference
impl Sync for ServerCachePreference
impl Unpin for ServerCachePreference
impl UnwindSafe for ServerCachePreference
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.