#[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
pub fn new() -> Self
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more