class CfnCachePolicyPropsMixin
| Language | Type name |
|---|---|
.NET | Amazon.CDK.Mixins.Preview.AWS.CloudFront.Mixins.CfnCachePolicyPropsMixin |
Go | github.com/aws/aws-cdk-go/awscdkmixinspreview/v2/awscloudfront/mixins#CfnCachePolicyPropsMixin |
Java | software.amazon.awscdk.mixins.preview.services.cloudfront.mixins.CfnCachePolicyPropsMixin |
Python | aws_cdk.mixins_preview.aws_cloudfront.mixins.CfnCachePolicyPropsMixin |
TypeScript | @aws-cdk/mixins-preview » aws_cloudfront » mixins » CfnCachePolicyPropsMixin |
Implements
IMixin
Extends
Mixin
A cache policy.
When it's attached to a cache behavior, the cache policy 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 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 .
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { mixins } from '@aws-cdk/mixins-preview';
import { mixins as cloudfront_mixins } from '@aws-cdk/mixins-preview/aws-cloudfront';
const cfnCachePolicyPropsMixin = new cloudfront_mixins.CfnCachePolicyPropsMixin({
cachePolicyConfig: {
comment: 'comment',
defaultTtl: 123,
maxTtl: 123,
minTtl: 123,
name: 'name',
parametersInCacheKeyAndForwardedToOrigin: {
cookiesConfig: {
cookieBehavior: 'cookieBehavior',
cookies: ['cookies'],
},
enableAcceptEncodingBrotli: false,
enableAcceptEncodingGzip: false,
headersConfig: {
headerBehavior: 'headerBehavior',
headers: ['headers'],
},
queryStringsConfig: {
queryStringBehavior: 'queryStringBehavior',
queryStrings: ['queryStrings'],
},
},
},
}, /* all optional props */ {
strategy: mixins.PropertyMergeStrategy.OVERRIDE,
});
Initializer
new CfnCachePolicyPropsMixin(props: CfnCachePolicyMixinProps, options?: CfnPropertyMixinOptions)
Parameters
- props
Cfn— L1 properties to apply.Cache Policy Mixin Props - options
Cfn— Mixin options.Property Mixin Options
Create a mixin to apply properties to AWS::CloudFront::CachePolicy.
Properties
| Name | Type | Description |
|---|---|---|
| props | Cfn | |
| strategy | Property | |
| static CFN_PROPERTY_KEYS | string[] |
props
Type:
Cfn
strategy
Type:
Property
static CFN_PROPERTY_KEYS
Type:
string[]
Methods
| Name | Description |
|---|---|
| apply | Apply the mixin properties to the construct. |
| supports(construct) | Check if this mixin supports the given construct. |
applyTo(construct)
public applyTo(construct: IConstruct): IConstruct
Parameters
- construct
IConstruct
Returns
Apply the mixin properties to the construct.
supports(construct)
public supports(construct: IConstruct): boolean
Parameters
- construct
IConstruct
Returns
boolean
Check if this mixin supports the given construct.

.NET
Go
Java
Python
TypeScript