Skip to main content

CachePolicyCacheKeyPolicy

Struct CachePolicyCacheKeyPolicy 

Source
#[non_exhaustive]
pub struct CachePolicyCacheKeyPolicy { pub excluded_query_parameters: Vec<String>, pub include_host: Option<bool>, pub include_protocol: Option<bool>, pub include_query_string: Option<bool>, pub included_cookie_names: Vec<String>, pub included_header_names: Vec<String>, pub included_query_parameters: Vec<String>, /* private fields */ }
Available on crate features region-url-maps or url-maps only.
Expand description

Message containing what to include in the cache key for a request for Cache Policy defined on Route Action.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§excluded_query_parameters: Vec<String>

Names of query string parameters to exclude in cache keys. All other parameters will be included. Either specify excludedQueryParameters or includedQueryParameters, not both. ‘&’ and ‘=’ will be percent encoded and not treated as delimiters.

Note: This field applies to routes that use backend services. Attempting to set it on a route that points exclusively to Backend Buckets will result in a configuration error. For routes that point to a Backend Bucket, use includedQueryParameters to define which parameters should be part of the cache key.

§include_host: Option<bool>

If true, requests to different hosts will be cached separately.

Note: This setting is only applicable to routes that use a Backend Service. It does not affect requests served by a Backend Bucket, as the host is never included in a Backend Bucket’s cache key. Attempting to set it on a route that points exclusively to Backend Buckets will result in a configuration error.

§include_protocol: Option<bool>

If true, http and https requests will be cached separately.

Note: This setting is only applicable to routes that use a Backend Service. It does not affect requests served by a Backend Bucket, as the protocol is never included in a Backend Bucket’s cache key. Attempting to set on a route that points exclusively to Backend Buckets will result in a configuration error.

§include_query_string: Option<bool>

If true, include query string parameters in the cache key according to includedQueryParameters and excludedQueryParameters. If neither is set, the entire query string will be included. If false, the query string will be excluded from the cache key entirely.

Note: This field applies to routes that use backend services. Attempting to set it on a route that points exclusively to Backend Buckets will result in a configuration error. For routes that point to a Backend Bucket, use includedQueryParameters to define which parameters should be part of the cache key.

§included_cookie_names: Vec<String>

Allows HTTP cookies (by name) to be used in the cache key. The name=value pair will be used in the cache key Cloud CDN generates.

Note: This setting is only applicable to routes that use a Backend Service. It does not affect requests served by a Backend Bucket. Attempting to set it on a route that points exclusively to Backend Buckets will result in a configuration error. Up to 5 cookie names can be specified.

§included_header_names: Vec<String>

Allows HTTP request headers (by name) to be used in the cache key.

§included_query_parameters: Vec<String>

Names of query string parameters to include in cache keys. All other parameters will be excluded. Either specify includedQueryParameters or excludedQueryParameters, not both. ‘&’ and ‘=’ will be percent encoded and not treated as delimiters.

Implementations§

Source§

impl CachePolicyCacheKeyPolicy

Source

pub fn new() -> Self

Creates a new default instance.

Source

pub fn set_excluded_query_parameters<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of excluded_query_parameters.

§Example
let x = CachePolicyCacheKeyPolicy::new().set_excluded_query_parameters(["a", "b", "c"]);
Source

pub fn set_include_host<T>(self, v: T) -> Self
where T: Into<bool>,

Sets the value of include_host.

§Example
let x = CachePolicyCacheKeyPolicy::new().set_include_host(true);
Source

pub fn set_or_clear_include_host<T>(self, v: Option<T>) -> Self
where T: Into<bool>,

Sets or clears the value of include_host.

§Example
let x = CachePolicyCacheKeyPolicy::new().set_or_clear_include_host(Some(false));
let x = CachePolicyCacheKeyPolicy::new().set_or_clear_include_host(None::<bool>);
Source

pub fn set_include_protocol<T>(self, v: T) -> Self
where T: Into<bool>,

Sets the value of include_protocol.

§Example
let x = CachePolicyCacheKeyPolicy::new().set_include_protocol(true);
Source

pub fn set_or_clear_include_protocol<T>(self, v: Option<T>) -> Self
where T: Into<bool>,

Sets or clears the value of include_protocol.

§Example
let x = CachePolicyCacheKeyPolicy::new().set_or_clear_include_protocol(Some(false));
let x = CachePolicyCacheKeyPolicy::new().set_or_clear_include_protocol(None::<bool>);
Source

pub fn set_include_query_string<T>(self, v: T) -> Self
where T: Into<bool>,

Sets the value of include_query_string.

§Example
let x = CachePolicyCacheKeyPolicy::new().set_include_query_string(true);
Source

pub fn set_or_clear_include_query_string<T>(self, v: Option<T>) -> Self
where T: Into<bool>,

Sets or clears the value of include_query_string.

§Example
let x = CachePolicyCacheKeyPolicy::new().set_or_clear_include_query_string(Some(false));
let x = CachePolicyCacheKeyPolicy::new().set_or_clear_include_query_string(None::<bool>);

Sets the value of included_cookie_names.

§Example
let x = CachePolicyCacheKeyPolicy::new().set_included_cookie_names(["a", "b", "c"]);
Source

pub fn set_included_header_names<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of included_header_names.

§Example
let x = CachePolicyCacheKeyPolicy::new().set_included_header_names(["a", "b", "c"]);
Source

pub fn set_included_query_parameters<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of included_query_parameters.

§Example
let x = CachePolicyCacheKeyPolicy::new().set_included_query_parameters(["a", "b", "c"]);

Trait Implementations§

Source§

impl Clone for CachePolicyCacheKeyPolicy

Source§

fn clone(&self) -> CachePolicyCacheKeyPolicy

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CachePolicyCacheKeyPolicy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CachePolicyCacheKeyPolicy

Source§

fn default() -> CachePolicyCacheKeyPolicy

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

impl Message for CachePolicyCacheKeyPolicy

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for CachePolicyCacheKeyPolicy

Source§

fn eq(&self, other: &CachePolicyCacheKeyPolicy) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for CachePolicyCacheKeyPolicy

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,