Class CachePolicy

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.cloudfront.CachePolicy
All Implemented Interfaces:
IConstruct, IDependable, IResource, ICachePolicy, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:43.445Z") @Stability(Stable) public class CachePolicy extends Resource implements ICachePolicy
A Cache Policy configuration.

Example:

 // Using an existing cache policy for a Distribution
 S3Origin bucketOrigin;
 Distribution.Builder.create(this, "myDistManagedPolicy")
         .defaultBehavior(BehaviorOptions.builder()
                 .origin(bucketOrigin)
                 .cachePolicy(CachePolicy.CACHING_OPTIMIZED)
                 .build())
         .build();
 
  • Field Details

    • AMPLIFY

      @Stability(Stable) public static final ICachePolicy AMPLIFY
      This policy is designed for use with an origin that is an AWS Amplify web app.
    • CACHING_DISABLED

      @Stability(Stable) public static final ICachePolicy CACHING_DISABLED
      Disables caching.

      This policy is useful for dynamic content and for requests that are not cacheable.

    • CACHING_OPTIMIZED

      @Stability(Stable) public static final ICachePolicy CACHING_OPTIMIZED
      Optimize cache efficiency by minimizing the values that CloudFront includes in the cache key.

      Query strings and cookies are not included in the cache key, and only the normalized 'Accept-Encoding' header is included.

    • CACHING_OPTIMIZED_FOR_UNCOMPRESSED_OBJECTS

      @Stability(Stable) public static final ICachePolicy CACHING_OPTIMIZED_FOR_UNCOMPRESSED_OBJECTS
      Optimize cache efficiency by minimizing the values that CloudFront includes in the cache key.

      Query strings and cookies are not included in the cache key, and only the normalized 'Accept-Encoding' header is included. Disables cache compression.

    • ELEMENTAL_MEDIA_PACKAGE

      @Stability(Stable) public static final ICachePolicy ELEMENTAL_MEDIA_PACKAGE
      Designed for use with an origin that is an AWS Elemental MediaPackage endpoint.
  • Constructor Details

    • CachePolicy

      protected CachePolicy(software.amazon.jsii.JsiiObjectRef objRef)
    • CachePolicy

      protected CachePolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CachePolicy

      @Stability(Stable) public CachePolicy(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CachePolicyProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • CachePolicy

      @Stability(Stable) public CachePolicy(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • fromCachePolicyId

      @Stability(Stable) @NotNull public static ICachePolicy fromCachePolicyId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String cachePolicyId)
      Imports a Cache Policy from its id.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      cachePolicyId - This parameter is required.
    • getCachePolicyId

      @Stability(Stable) @NotNull public String getCachePolicyId()
      The ID of the cache policy.
      Specified by:
      getCachePolicyId in interface ICachePolicy