Class: AWSCDK::CloudFront::CfnCachePolicy::CachePolicyConfigProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::CloudFront::CfnCachePolicy::CachePolicyConfigProperty
- Defined in:
- cloud_front/cfn_cache_policy.rb
Overview
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.
If your minimum TTL is greater than 0, CloudFront will cache content for at least the duration specified in the cache policy's minimum TTL, even if the
Cache-Control: no-cache,no-store, orprivatedirectives are present in the origin headers.
The headers, cookies, and query strings that are included in the cache key are also 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 .
Instance Attribute Summary collapse
-
#comment ⇒ String?
readonly
A comment to describe the cache policy.
-
#default_ttl ⇒ Numeric
readonly
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.
-
#max_ttl ⇒ Numeric
readonly
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.
-
#min_ttl ⇒ Numeric
readonly
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.
-
#name ⇒ String
readonly
A unique name to identify the cache policy.
-
#parameters_in_cache_key_and_forwarded_to_origin ⇒ AWSCDK::IResolvable, AWSCDK::CloudFront::CfnCachePolicy::ParametersInCacheKeyAndForwardedToOriginProperty
readonly
The HTTP headers, cookies, and URL query strings to include in the cache key.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(default_ttl:, max_ttl:, min_ttl:, name:, parameters_in_cache_key_and_forwarded_to_origin:, comment: nil) ⇒ CachePolicyConfigProperty
constructor
A new instance of CachePolicyConfigProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(default_ttl:, max_ttl:, min_ttl:, name:, parameters_in_cache_key_and_forwarded_to_origin:, comment: nil) ⇒ CachePolicyConfigProperty
Returns a new instance of CachePolicyConfigProperty.
539 540 541 542 543 544 545 546 547 548 549 550 551 552 |
# File 'cloud_front/cfn_cache_policy.rb', line 539 def initialize(default_ttl:, max_ttl:, min_ttl:, name:, parameters_in_cache_key_and_forwarded_to_origin:, comment: nil) @default_ttl = default_ttl Jsii::Type.check_type(@default_ttl, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "defaultTtl") @max_ttl = max_ttl Jsii::Type.check_type(@max_ttl, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maxTtl") @min_ttl = min_ttl Jsii::Type.check_type(@min_ttl, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "minTtl") @name = name Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") @parameters_in_cache_key_and_forwarded_to_origin = parameters_in_cache_key_and_forwarded_to_origin.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnCachePolicy::ParametersInCacheKeyAndForwardedToOriginProperty.new(**parameters_in_cache_key_and_forwarded_to_origin.transform_keys(&:to_sym)) : parameters_in_cache_key_and_forwarded_to_origin Jsii::Type.check_type(@parameters_in_cache_key_and_forwarded_to_origin, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmbkNhY2hlUG9saWN5LlBhcmFtZXRlcnNJbkNhY2hlS2V5QW5kRm9yd2FyZGVkVG9PcmlnaW5Qcm9wZXJ0eSJ9XX19")), "parametersInCacheKeyAndForwardedToOrigin") @comment = comment Jsii::Type.check_type(@comment, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "comment") unless @comment.nil? end |
Instance Attribute Details
#comment ⇒ String? (readonly)
A comment to describe the cache policy.
The comment cannot be longer than 128 characters.
597 598 599 |
# File 'cloud_front/cfn_cache_policy.rb', line 597 def comment @comment end |
#default_ttl ⇒ Numeric (readonly)
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 .
562 563 564 |
# File 'cloud_front/cfn_cache_policy.rb', line 562 def default_ttl @default_ttl end |
#max_ttl ⇒ Numeric (readonly)
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 .
571 572 573 |
# File 'cloud_front/cfn_cache_policy.rb', line 571 def max_ttl @max_ttl end |
#min_ttl ⇒ Numeric (readonly)
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 .
578 579 580 |
# File 'cloud_front/cfn_cache_policy.rb', line 578 def min_ttl @min_ttl end |
#name ⇒ String (readonly)
A unique name to identify the cache policy.
583 584 585 |
# File 'cloud_front/cfn_cache_policy.rb', line 583 def name @name end |
#parameters_in_cache_key_and_forwarded_to_origin ⇒ AWSCDK::IResolvable, AWSCDK::CloudFront::CfnCachePolicy::ParametersInCacheKeyAndForwardedToOriginProperty (readonly)
The HTTP headers, cookies, and URL query strings to include in the cache key.
The values included in the cache key are also included in requests that CloudFront sends to the origin.
590 591 592 |
# File 'cloud_front/cfn_cache_policy.rb', line 590 def parameters_in_cache_key_and_forwarded_to_origin @parameters_in_cache_key_and_forwarded_to_origin end |
Class Method Details
.jsii_properties ⇒ Object
599 600 601 602 603 604 605 606 607 608 |
# File 'cloud_front/cfn_cache_policy.rb', line 599 def self.jsii_properties { :default_ttl => "defaultTtl", :max_ttl => "maxTtl", :min_ttl => "minTtl", :name => "name", :parameters_in_cache_key_and_forwarded_to_origin => "parametersInCacheKeyAndForwardedToOrigin", :comment => "comment", } end |
Instance Method Details
#to_jsii ⇒ Object
610 611 612 613 614 615 616 617 618 619 620 621 |
# File 'cloud_front/cfn_cache_policy.rb', line 610 def to_jsii result = {} result.merge!({ "defaultTtl" => @default_ttl, "maxTtl" => @max_ttl, "minTtl" => @min_ttl, "name" => @name, "parametersInCacheKeyAndForwardedToOrigin" => @parameters_in_cache_key_and_forwarded_to_origin, "comment" => @comment, }) result.compact end |