public static final class CachePolicy.Builder
extends java.lang.Object
CachePolicy
.Modifier and Type | Method and Description |
---|---|
CachePolicy |
build() |
CachePolicy.Builder |
cachePolicyName(java.lang.String cachePolicyName)
A unique name to identify the cache policy.
|
CachePolicy.Builder |
comment(java.lang.String comment)
A comment to describe the cache policy.
|
CachePolicy.Builder |
cookieBehavior(CacheCookieBehavior cookieBehavior)
Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin.
|
static CachePolicy.Builder |
create(software.constructs.Construct scope,
java.lang.String id) |
CachePolicy.Builder |
defaultTtl(Duration defaultTtl)
The default amount of time for objects to stay in the CloudFront cache.
|
CachePolicy.Builder |
enableAcceptEncodingBrotli(java.lang.Boolean enableAcceptEncodingBrotli)
Whether to normalize and include the `Accept-Encoding` header in the cache key when the `Accept-Encoding` header is 'br'.
|
CachePolicy.Builder |
enableAcceptEncodingGzip(java.lang.Boolean enableAcceptEncodingGzip)
Whether to normalize and include the `Accept-Encoding` header in the cache key when the `Accept-Encoding` header is 'gzip'.
|
CachePolicy.Builder |
headerBehavior(CacheHeaderBehavior headerBehavior)
Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin.
|
CachePolicy.Builder |
maxTtl(Duration maxTtl)
The maximum amount of time for objects to stay in the CloudFront cache.
|
CachePolicy.Builder |
minTtl(Duration minTtl)
The minimum amount of time for objects to stay in the CloudFront cache.
|
CachePolicy.Builder |
queryStringBehavior(CacheQueryStringBehavior queryStringBehavior)
Determines whether any query strings are included in the cache key and automatically included in requests that CloudFront sends to the origin.
|
public static CachePolicy.Builder create(software.constructs.Construct scope, java.lang.String id)
scope
- This parameter is required.id
- This parameter is required.CachePolicy.Builder
.public CachePolicy.Builder cachePolicyName(java.lang.String cachePolicyName)
The name must only include '-', '_', or alphanumeric characters.
Default: - generated from the `id`
cachePolicyName
- A unique name to identify the cache policy. This parameter is required.this
public CachePolicy.Builder comment(java.lang.String comment)
Default: - no comment
comment
- A comment to describe the cache policy. This parameter is required.this
public CachePolicy.Builder cookieBehavior(CacheCookieBehavior cookieBehavior)
Default: CacheCookieBehavior.none()
cookieBehavior
- Determines whether any cookies in viewer requests are included in the cache key and automatically included in requests that CloudFront sends to the origin. This parameter is required.this
public CachePolicy.Builder defaultTtl(Duration defaultTtl)
Only used when the origin does not send Cache-Control or Expires headers with the object.
Default: - The greater of 1 day and ``minTtl``
defaultTtl
- The default amount of time for objects to stay in the CloudFront cache. This parameter is required.this
public CachePolicy.Builder enableAcceptEncodingBrotli(java.lang.Boolean enableAcceptEncodingBrotli)
Default: false
enableAcceptEncodingBrotli
- Whether to normalize and include the `Accept-Encoding` header in the cache key when the `Accept-Encoding` header is 'br'. This parameter is required.this
public CachePolicy.Builder enableAcceptEncodingGzip(java.lang.Boolean enableAcceptEncodingGzip)
Default: false
enableAcceptEncodingGzip
- Whether to normalize and include the `Accept-Encoding` header in the cache key when the `Accept-Encoding` header is 'gzip'. This parameter is required.this
public CachePolicy.Builder headerBehavior(CacheHeaderBehavior headerBehavior)
Default: CacheHeaderBehavior.none()
headerBehavior
- Determines whether any HTTP headers are included in the cache key and automatically included in requests that CloudFront sends to the origin. This parameter is required.this
public CachePolicy.Builder maxTtl(Duration maxTtl)
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``
maxTtl
- The maximum amount of time for objects to stay in the CloudFront cache. This parameter is required.this
public CachePolicy.Builder minTtl(Duration minTtl)
Default: Duration.seconds(0)
minTtl
- The minimum amount of time for objects to stay in the CloudFront cache. This parameter is required.this
public CachePolicy.Builder queryStringBehavior(CacheQueryStringBehavior queryStringBehavior)
Default: CacheQueryStringBehavior.none()
queryStringBehavior
- Determines whether any query strings are included in the cache key and automatically included in requests that CloudFront sends to the origin. This parameter is required.this
public CachePolicy build()