Skip to main content

CacheInfo

Struct CacheInfo 

Source
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: bool

Whether 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: bool

The 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

Source

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.

Source

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.

Trait Implementations§

Source§

impl Default for CacheInfo

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more