Class CfnCachePolicy.CachePolicyConfigProperty
A cache policy configuration.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnCachePolicy.CachePolicyConfigProperty : CfnCachePolicy.ICachePolicyConfigProperty
Syntax (vb)
Public Class CfnCachePolicy.CachePolicyConfigProperty Implements CfnCachePolicy.ICachePolicyConfigProperty
Remarks
This configuration determines the following:
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 <code>Cache-Control: no-cache</code> , <code>no-store</code> , or <code>private</code> directives 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 .
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
Constructors
| CachePolicyConfigProperty() | A cache policy configuration. |
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. |
Constructors
CachePolicyConfigProperty()
A cache policy configuration.
public CachePolicyConfigProperty()
Remarks
This configuration determines the following:
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 <code>Cache-Control: no-cache</code> , <code>no-store</code> , or <code>private</code> directives 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 .
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"
};
Properties
Comment
A comment to describe the cache policy.
public string? Comment { get; set; }
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.
public double DefaultTtl { get; set; }
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.
public double MaxTtl { get; set; }
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.
public double MinTtl { get; set; }
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.
public string Name { get; set; }
Property Value
Remarks
ParametersInCacheKeyAndForwardedToOrigin
The HTTP headers, cookies, and URL query strings to include in the cache key.
public object ParametersInCacheKeyAndForwardedToOrigin { get; set; }
Property Value
Remarks
The values included in the cache key are also included in requests that CloudFront sends to the origin.
Type union: either IResolvable or CfnCachePolicy.IParametersInCacheKeyAndForwardedToOriginProperty