@Generated(value="jsii-pacmak/1.50.0 (build d1830a4)", date="2022-01-11T17:58:48.618Z") @Stability(value=Stable) public interface CachePolicyProps extends software.amazon.jsii.JsiiSerializable
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();
| Modifier and Type | Interface and Description |
|---|---|
static class |
CachePolicyProps.Builder
A builder for
CachePolicyProps |
static class |
CachePolicyProps.Jsii$Proxy
An implementation for
CachePolicyProps |
| Modifier and Type | Method and Description |
|---|---|
static CachePolicyProps.Builder |
builder() |
default String |
getCachePolicyName()
A unique name to identify the cache policy.
|
default String |
getComment()
A comment to describe the cache policy.
|
default CacheCookieBehavior |
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 Duration |
getDefaultTtl()
The default amount of time for objects to stay in the CloudFront cache.
|
default Boolean |
getEnableAcceptEncodingBrotli()
Whether to normalize and include the `Accept-Encoding` header in the cache key when the `Accept-Encoding` header is 'br'.
|
default Boolean |
getEnableAcceptEncodingGzip()
Whether to normalize and include the `Accept-Encoding` header in the cache key when the `Accept-Encoding` header is 'gzip'.
|
default CacheHeaderBehavior |
getHeaderBehavior()
Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin.
|
default Duration |
getMaxTtl()
The maximum amount of time for objects to stay in the CloudFront cache.
|
default Duration |
getMinTtl()
The minimum amount of time for objects to stay in the CloudFront cache.
|
default CacheQueryStringBehavior |
getQueryStringBehavior()
Determines whether any query strings are included in the cache key and automatically included in requests that CloudFront sends to the origin.
|
@Stability(value=Stable) @Nullable default String getCachePolicyName()
The name must only include '-', '_', or alphanumeric characters.
Default: - generated from the `id`
@Stability(value=Stable) @Nullable default String getComment()
Default: - no comment
@Stability(value=Stable) @Nullable default CacheCookieBehavior getCookieBehavior()
Default: CacheCookieBehavior.none()
@Stability(value=Stable) @Nullable default Duration getDefaultTtl()
Only used when the origin does not send Cache-Control or Expires headers with the object.
Default: - The greater of 1 day and ``minTtl``
@Stability(value=Stable) @Nullable default Boolean getEnableAcceptEncodingBrotli()
Default: false
@Stability(value=Stable) @Nullable default Boolean getEnableAcceptEncodingGzip()
Default: false
@Stability(value=Stable) @Nullable default CacheHeaderBehavior getHeaderBehavior()
Default: CacheHeaderBehavior.none()
@Stability(value=Stable) @Nullable default Duration getMaxTtl()
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``
@Stability(value=Stable) @Nullable default Duration getMinTtl()
Default: Duration.seconds(0)
@Stability(value=Stable) @Nullable default CacheQueryStringBehavior getQueryStringBehavior()
Default: CacheQueryStringBehavior.none()
@Stability(value=Stable) static CachePolicyProps.Builder builder()
CachePolicyProps.Builder of CachePolicyPropsCopyright © 2022. All rights reserved.