Interface CfnCachePolicy.ICachePolicyConfigProperty
A cache policy configuration.
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface CfnCachePolicy.ICachePolicyConfigProperty
Syntax (vb)
Public Interface CfnCachePolicy.ICachePolicyConfigProperty
Remarks
This configuration determines the following:
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
.
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudFront;
var cachePolicyConfigProperty = new CachePolicyConfigProperty {
DefaultTtl = 123,
MaxTtl = 123,
MinTtl = 123,
Name = "name",
ParametersInCacheKeyAndForwardedToOrigin = new ParametersInCacheKeyAndForwardedToOriginProperty {
CookiesConfig = new CookiesConfigProperty {
CookieBehavior = "cookieBehavior",
// the properties below are optional
Cookies = new [] { "cookies" }
},
EnableAcceptEncodingGzip = false,
HeadersConfig = new HeadersConfigProperty {
HeaderBehavior = "headerBehavior",
// the properties below are optional
Headers = new [] { "headers" }
},
QueryStringsConfig = new QueryStringsConfigProperty {
QueryStringBehavior = "queryStringBehavior",
// the properties below are optional
QueryStrings = new [] { "queryStrings" }
},
// the properties below are optional
EnableAcceptEncodingBrotli = false
},
// the properties below are optional
Comment = "comment"
};
Synopsis
Properties
Comment | A comment to describe the cache policy. |
DefaultTtl | 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. |
MaxTtl | 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. |
MinTtl | 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 | A unique name to identify the cache policy. |
ParametersInCacheKeyAndForwardedToOrigin | The HTTP headers, cookies, and URL query strings to include in the cache key. |
Properties
Comment
A comment to describe the cache policy.
string? Comment { get; }
Property Value
Remarks
The comment cannot be longer than 128 characters.
DefaultTtl
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.
double DefaultTtl { get; }
Property Value
Remarks
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
.
MaxTtl
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.
double MaxTtl { get; }
Property Value
Remarks
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
.
MinTtl
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.
double MinTtl { get; }
Property Value
Remarks
For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide .
Name
A unique name to identify the cache policy.
string Name { get; }
Property Value
Remarks
ParametersInCacheKeyAndForwardedToOrigin
The HTTP headers, cookies, and URL query strings to include in the cache key.
object ParametersInCacheKeyAndForwardedToOrigin { get; }
Property Value
Remarks
The values included in the cache key are also included in requests that CloudFront sends to the origin.