pub struct CacheInfo {Show 14 fields
pub namespace: Option<String>,
pub keys: Option<Vec<String>>,
pub key_variants: Option<Vec<CacheKeyVariant>>,
pub check_cache_control: bool,
pub max_ttl: Option<Duration>,
pub vary_headers: Option<Arc<Vec<String>>>,
pub default_ttl: Option<Duration>,
pub status_ttl: Option<Arc<Vec<(u16, Duration)>>>,
pub query_rule: Option<Arc<CacheQueryRule>>,
pub key_query: Option<String>,
pub key_headers: Option<Arc<Vec<String>>>,
pub revalidate: bool,
pub reading_count: Option<u32>,
pub writing_count: Option<u32>,
}Expand description
All cache-related configuration and statistics for a request.
Fields§
§namespace: Option<String>The namespace for cache entries.
keys: Option<Vec<String>>The list of keys used to generate the final cache key.
key_variants: Option<Vec<CacheKeyVariant>>Which of keys are one alternative among several, see
CacheKeyVariant.
check_cache_control: boolWhether to respect Cache-Control headers.
max_ttl: Option<Duration>The maximum time-to-live for cache entries.
vary_headers: Option<Arc<Vec<String>>>Request headers the origin’s Vary response header may turn into
cache variants (lowercased); None honours every header it names.
default_ttl: Option<Duration>How long a response stays fresh when the origin names no lifetime, for the statuses that are kept by default, in place of one second.
status_ttl: Option<Arc<Vec<(u16, Duration)>>>The same for single statuses, also ones that are not kept by
default: (status, lifetime). A lifetime of zero keeps a status
out.
query_rule: Option<Arc<CacheQueryRule>>Which parameters of the query the cache key is made of, where the plugin has a rule for that.
key_query: Option<String>The query the key of this request was made of by that rule, from
the moment the key is made (settle_key_query): with the
parameters the rule leaves out gone and the others in order.
Empty for no query at all. The upstream is asked with it too, see
ask_with_key_query.
key_headers: Option<Arc<Vec<String>>>The request headers the key is made of as well (headers of the
cache plugin), by name. Their values are read when the key is
made, see CacheInfo::header_key_components.
revalidate: boolThe client asked for a copy that is checked with the origin
(Cache-Control: no-cache), and the plugin lets clients do that:
what is cached is revalidated before it is served.
reading_count: Option<u32>The number of cache read operations performed.
writing_count: Option<u32>The number of cache write operations performed.
Implementations§
Source§impl CacheInfo
impl CacheInfo
Sourcepub fn settle_key_query(&mut self, header: &RequestHeader)
pub fn settle_key_query(&mut self, header: &RequestHeader)
Makes the query the cache key is made of, from the request as it
is now. Called when the key is made, which is after the request
plugins have run: one that takes a parameter out of the query
(key_auth with hide_credentials) has done so by then, also
when it is listed after the cache. Taken when the cache plugin
ran, the key query had the credential in it, and the upstream was
then asked with what was meant to be hidden from it.
Sourcepub fn ask_with_key_query(&self, header: &mut RequestHeader) -> bool
pub fn ask_with_key_query(&self, header: &mut RequestHeader) -> bool
Gives header, the request that goes to the upstream, the query
the cache key is made of, where that is not the request’s own.
The key says which parameters a response depends on; with the
others sent on all the same it was the upstream that decided. A
parameter spelled another way than the rule has it (p%61ge=2
for page, x=1;page=2) was left out of the key and read by the
upstream, and page 2 was stored as the page without a number, for
everyone. Asked with the query of the key, the upstream can not
tell two requests of one key apart.
Only the request to the upstream is changed, not the client’s:
the access log and the plugins see what was asked for. false
when the uri can not be made, and then the request must not be
sent as it is.