Interface CachePolicyProps
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
CachePolicyProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:43.447Z")
@Stability(Stable)
public interface CachePolicyProps
extends software.amazon.jsii.JsiiSerializable
Properties for creating a Cache Policy.
Example:
// Creating a custom cache policy for a Distribution -- all parameters optional
S3Origin bucketOrigin;
CachePolicy myCachePolicy = CachePolicy.Builder.create(this, "myCachePolicy")
.cachePolicyName("MyPolicy")
.comment("A default policy")
.defaultTtl(Duration.days(2))
.minTtl(Duration.minutes(1))
.maxTtl(Duration.days(10))
.cookieBehavior(CacheCookieBehavior.all())
.headerBehavior(CacheHeaderBehavior.allowList("X-CustomHeader"))
.queryStringBehavior(CacheQueryStringBehavior.denyList("username"))
.enableAcceptEncodingGzip(true)
.enableAcceptEncodingBrotli(true)
.build();
Distribution.Builder.create(this, "myDistCustomPolicy")
.defaultBehavior(BehaviorOptions.builder()
.origin(bucketOrigin)
.cachePolicy(myCachePolicy)
.build())
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forCachePolicyPropsstatic final classAn implementation forCachePolicyProps -
Method Summary
Modifier and TypeMethodDescriptionstatic CachePolicyProps.Builderbuilder()default StringA unique name to identify the cache policy.default StringA comment to describe the cache policy.default CacheCookieBehaviorDetermines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin.default DurationThe default amount of time for objects to stay in the CloudFront cache.default BooleanWhether to normalize and include theAccept-Encodingheader in the cache key when theAccept-Encodingheader is 'br'.default BooleanWhether to normalize and include theAccept-Encodingheader in the cache key when theAccept-Encodingheader is 'gzip'.default CacheHeaderBehaviorDetermines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin.default DurationThe maximum amount of time for objects to stay in the CloudFront cache.default DurationThe minimum amount of time for objects to stay in the CloudFront cache.default CacheQueryStringBehaviorDetermines whether any query strings are included in the cache key and automatically included in requests that CloudFront sends to the origin.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getCachePolicyName
A unique name to identify the cache policy.The name must only include '-', '_', or alphanumeric characters.
Default: - generated from the `id`
-
getComment
A comment to describe the cache policy.Default: - no comment
-
getCookieBehavior
Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin.Default: CacheCookieBehavior.none()
-
getDefaultTtl
The default amount of time for objects to stay in the CloudFront cache.Only used when the origin does not send Cache-Control or Expires headers with the object.
Default: - The greater of 1 day and ``minTtl``
-
getEnableAcceptEncodingBrotli
Whether to normalize and include theAccept-Encodingheader in the cache key when theAccept-Encodingheader is 'br'.Default: false
-
getEnableAcceptEncodingGzip
Whether to normalize and include theAccept-Encodingheader in the cache key when theAccept-Encodingheader is 'gzip'.Default: false
-
getHeaderBehavior
Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin.Default: CacheHeaderBehavior.none()
-
getMaxTtl
The maximum amount of time for objects to stay in the CloudFront cache.CloudFront uses this value only when the origin sends Cache-Control or Expires headers with the object.
Default: - The greater of 1 year and ``defaultTtl``
-
getMinTtl
The minimum amount of time for objects to stay in the CloudFront cache.Default: Duration.seconds(0)
-
getQueryStringBehavior
Determines whether any query strings are included in the cache key and automatically included in requests that CloudFront sends to the origin.Default: CacheQueryStringBehavior.none()
-
builder
- Returns:
- a
CachePolicyProps.BuilderofCachePolicyProps
-