#[non_exhaustive]pub struct CacheKeyPolicy {
pub include_host: Option<bool>,
pub include_http_headers: Vec<String>,
pub include_named_cookies: Vec<String>,
pub include_protocol: Option<bool>,
pub include_query_string: Option<bool>,
pub query_string_blacklist: Vec<String>,
pub query_string_whitelist: Vec<String>,
/* private fields */
}backend-services or region-backend-services only.Expand description
Message containing what to include in the cache key for a request for Cloud CDN.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.include_host: Option<bool>If true, requests to different hosts will be cached separately.
include_http_headers: Vec<String>Allows HTTP request headers (by name) to be used in the cache key.
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.
include_protocol: Option<bool>If true, http and https requests will be cached separately.
include_query_string: Option<bool>If true, include query string parameters in the cache key according to query_string_whitelist and query_string_blacklist. If neither is set, the entire query string will be included. If false, the query string will be excluded from the cache key entirely.
query_string_blacklist: Vec<String>Names of query string parameters to exclude in cache keys. All other parameters will be included. Either specify query_string_whitelist or query_string_blacklist, not both. ‘&’ and ‘=’ will be percent encoded and not treated as delimiters.
query_string_whitelist: Vec<String>Names of query string parameters to include in cache keys. All other parameters will be excluded. Either specify query_string_whitelist or query_string_blacklist, not both. ‘&’ and ‘=’ will be percent encoded and not treated as delimiters.
Implementations§
Source§impl CacheKeyPolicy
impl CacheKeyPolicy
Sourcepub fn set_include_host<T>(self, v: T) -> Self
pub fn set_include_host<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_include_host<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_include_host<T>(self, v: Option<T>) -> Self
Sets or clears the value of include_host.
§Example
let x = CacheKeyPolicy::new().set_or_clear_include_host(Some(false));
let x = CacheKeyPolicy::new().set_or_clear_include_host(None::<bool>);Sourcepub fn set_include_http_headers<T, V>(self, v: T) -> Self
pub fn set_include_http_headers<T, V>(self, v: T) -> Self
Sets the value of include_http_headers.
§Example
let x = CacheKeyPolicy::new().set_include_http_headers(["a", "b", "c"]);Sets the value of include_named_cookies.
§Example
let x = CacheKeyPolicy::new().set_include_named_cookies(["a", "b", "c"]);Sourcepub fn set_include_protocol<T>(self, v: T) -> Self
pub fn set_include_protocol<T>(self, v: T) -> Self
Sets the value of include_protocol.
§Example
let x = CacheKeyPolicy::new().set_include_protocol(true);Sourcepub fn set_or_clear_include_protocol<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_include_protocol<T>(self, v: Option<T>) -> Self
Sets or clears the value of include_protocol.
§Example
let x = CacheKeyPolicy::new().set_or_clear_include_protocol(Some(false));
let x = CacheKeyPolicy::new().set_or_clear_include_protocol(None::<bool>);Sourcepub fn set_include_query_string<T>(self, v: T) -> Self
pub fn set_include_query_string<T>(self, v: T) -> Self
Sets the value of include_query_string.
§Example
let x = CacheKeyPolicy::new().set_include_query_string(true);Sourcepub fn set_or_clear_include_query_string<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_include_query_string<T>(self, v: Option<T>) -> Self
Sets or clears the value of include_query_string.
§Example
let x = CacheKeyPolicy::new().set_or_clear_include_query_string(Some(false));
let x = CacheKeyPolicy::new().set_or_clear_include_query_string(None::<bool>);Sourcepub fn set_query_string_blacklist<T, V>(self, v: T) -> Self
pub fn set_query_string_blacklist<T, V>(self, v: T) -> Self
Sets the value of query_string_blacklist.
§Example
let x = CacheKeyPolicy::new().set_query_string_blacklist(["a", "b", "c"]);Sourcepub fn set_query_string_whitelist<T, V>(self, v: T) -> Self
pub fn set_query_string_whitelist<T, V>(self, v: T) -> Self
Sets the value of query_string_whitelist.
§Example
let x = CacheKeyPolicy::new().set_query_string_whitelist(["a", "b", "c"]);Trait Implementations§
Source§impl Clone for CacheKeyPolicy
impl Clone for CacheKeyPolicy
Source§fn clone(&self) -> CacheKeyPolicy
fn clone(&self) -> CacheKeyPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CacheKeyPolicy
impl Debug for CacheKeyPolicy
Source§impl Default for CacheKeyPolicy
impl Default for CacheKeyPolicy
Source§fn default() -> CacheKeyPolicy
fn default() -> CacheKeyPolicy
Source§impl Message for CacheKeyPolicy
impl Message for CacheKeyPolicy
Source§impl PartialEq for CacheKeyPolicy
impl PartialEq for CacheKeyPolicy
impl StructuralPartialEq for CacheKeyPolicy
Auto Trait Implementations§
impl Freeze for CacheKeyPolicy
impl RefUnwindSafe for CacheKeyPolicy
impl Send for CacheKeyPolicy
impl Sync for CacheKeyPolicy
impl Unpin for CacheKeyPolicy
impl UnsafeUnpin for CacheKeyPolicy
impl UnwindSafe for CacheKeyPolicy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request