Struct aws_sdk_cloudfront::model::CachePolicyConfig
source · #[non_exhaustive]pub struct CachePolicyConfig { /* private fields */ }
Expand description
A cache policy configuration.
This configuration determines the following:
-
The values that CloudFront includes in the cache key. These values can include HTTP headers, cookies, and URL query strings. CloudFront uses the cache key to find an object in its cache that it can return to the viewer.
-
The default, minimum, and maximum time to live (TTL) values that you want objects to stay in the CloudFront cache.
The headers, cookies, and query strings that are included in the cache key are automatically included in requests that CloudFront sends to the origin. CloudFront sends a request when it can’t find a valid object in its cache that matches the request’s cache key. If you want to send values to the origin but not include them in the cache key, use OriginRequestPolicy
.
Implementations§
source§impl CachePolicyConfig
impl CachePolicyConfig
sourcepub fn comment(&self) -> Option<&str>
pub fn comment(&self) -> Option<&str>
A comment to describe the cache policy. The comment cannot be longer than 128 characters.
sourcepub fn default_ttl(&self) -> Option<i64>
pub fn default_ttl(&self) -> Option<i64>
The default amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated. CloudFront uses this value as the object’s time to live (TTL) only when the origin does not send Cache-Control
or Expires
headers with the object. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide.
The default value for this field is 86400 seconds (one day). If the value of MinTTL
is more than 86400 seconds, then the default value for this field is the same as the value of MinTTL
.
sourcepub fn max_ttl(&self) -> Option<i64>
pub fn max_ttl(&self) -> Option<i64>
The maximum amount of time, in seconds, that objects stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated. CloudFront uses this value only when the origin sends Cache-Control
or Expires
headers with the object. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide.
The default value for this field is 31536000 seconds (one year). If the value of MinTTL
or DefaultTTL
is more than 31536000 seconds, then the default value for this field is the same as the value of DefaultTTL
.
sourcepub fn min_ttl(&self) -> Option<i64>
pub fn min_ttl(&self) -> Option<i64>
The minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide.
sourcepub fn parameters_in_cache_key_and_forwarded_to_origin(
&self
) -> Option<&ParametersInCacheKeyAndForwardedToOrigin>
pub fn parameters_in_cache_key_and_forwarded_to_origin(
&self
) -> Option<&ParametersInCacheKeyAndForwardedToOrigin>
The HTTP headers, cookies, and URL query strings to include in the cache key. The values included in the cache key are automatically included in requests that CloudFront sends to the origin.
source§impl CachePolicyConfig
impl CachePolicyConfig
sourcepub fn builder() -> Builder
pub fn builder() -> Builder
Creates a new builder-style object to manufacture CachePolicyConfig
.
Examples found in repository?
6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043
pub fn deser_structure_crate_model_cache_policy_config(
decoder: &mut aws_smithy_xml::decode::ScopedDecoder,
) -> Result<crate::model::CachePolicyConfig, aws_smithy_xml::decode::XmlDecodeError> {
#[allow(unused_mut)]
let mut builder = crate::model::CachePolicyConfig::builder();
while let Some(mut tag) = decoder.next_tag() {
match tag.start_el() {
s if s.matches("Comment") /* Comment com.amazonaws.cloudfront#CachePolicyConfig$Comment */ => {
let var_199 =
Some(
Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_comment(var_199);
}
,
s if s.matches("Name") /* Name com.amazonaws.cloudfront#CachePolicyConfig$Name */ => {
let var_200 =
Some(
Result::<std::string::String, aws_smithy_xml::decode::XmlDecodeError>::Ok(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
.into()
)
?
)
;
builder = builder.set_name(var_200);
}
,
s if s.matches("DefaultTTL") /* DefaultTTL com.amazonaws.cloudfront#CachePolicyConfig$DefaultTTL */ => {
let var_201 =
Some(
{
<i64 as aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.cloudfront#long`)"))
}
?
)
;
builder = builder.set_default_ttl(var_201);
}
,
s if s.matches("MaxTTL") /* MaxTTL com.amazonaws.cloudfront#CachePolicyConfig$MaxTTL */ => {
let var_202 =
Some(
{
<i64 as aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.cloudfront#long`)"))
}
?
)
;
builder = builder.set_max_ttl(var_202);
}
,
s if s.matches("MinTTL") /* MinTTL com.amazonaws.cloudfront#CachePolicyConfig$MinTTL */ => {
let var_203 =
Some(
{
<i64 as aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
)
.map_err(|_|aws_smithy_xml::decode::XmlDecodeError::custom("expected (long: `com.amazonaws.cloudfront#long`)"))
}
?
)
;
builder = builder.set_min_ttl(var_203);
}
,
s if s.matches("ParametersInCacheKeyAndForwardedToOrigin") /* ParametersInCacheKeyAndForwardedToOrigin com.amazonaws.cloudfront#CachePolicyConfig$ParametersInCacheKeyAndForwardedToOrigin */ => {
let var_204 =
Some(
crate::xml_deser::deser_structure_crate_model_parameters_in_cache_key_and_forwarded_to_origin(&mut tag)
?
)
;
builder = builder.set_parameters_in_cache_key_and_forwarded_to_origin(var_204);
}
,
_ => {}
}
}
Ok(builder.build())
}
Trait Implementations§
source§impl Clone for CachePolicyConfig
impl Clone for CachePolicyConfig
source§fn clone(&self) -> CachePolicyConfig
fn clone(&self) -> CachePolicyConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more