Class CacheControl

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.s3.deployment.CacheControl
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:45.555Z") @Stability(Stable) public class CacheControl extends software.amazon.jsii.JsiiObject
Used for HTTP cache-control header, which influences downstream caches.

Example:

 Bucket destinationBucket;
 BucketDeployment.Builder.create(this, "BucketDeployment")
         .sources(List.of(Source.asset("./website", AssetOptions.builder().exclude(List.of("index.html")).build())))
         .destinationBucket(destinationBucket)
         .cacheControl(List.of(CacheControl.fromString("max-age=31536000,public,immutable")))
         .prune(false)
         .build();
 BucketDeployment.Builder.create(this, "HTMLBucketDeployment")
         .sources(List.of(Source.asset("./website", AssetOptions.builder().exclude(List.of("*", "!index.html")).build())))
         .destinationBucket(destinationBucket)
         .cacheControl(List.of(CacheControl.fromString("max-age=0,no-cache,no-store,must-revalidate")))
         .prune(false)
         .build();
 

See Also:
  • Constructor Details

    • CacheControl

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

      protected CacheControl(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
  • Method Details

    • fromString

      @Stability(Stable) @NotNull public static CacheControl fromString(@NotNull String s)
      Constructs a custom cache control key from the literal value.

      Parameters:
      s - This parameter is required.
    • maxAge

      @Stability(Stable) @NotNull public static CacheControl maxAge(@NotNull Duration t)
      Sets 'max-age=invalid input: '<'duration-in-seconds>'.

      Parameters:
      t - This parameter is required.
    • mustRevalidate

      @Stability(Stable) @NotNull public static CacheControl mustRevalidate()
      Sets 'must-revalidate'.
    • noCache

      @Stability(Stable) @NotNull public static CacheControl noCache()
      Sets 'no-cache'.
    • noTransform

      @Stability(Stable) @NotNull public static CacheControl noTransform()
      Sets 'no-transform'.
    • proxyRevalidate

      @Stability(Stable) @NotNull public static CacheControl proxyRevalidate()
      Sets 'proxy-revalidate'.
    • setPrivate

      @Stability(Stable) @NotNull public static CacheControl setPrivate()
      Sets 'private'.
    • setPublic

      @Stability(Stable) @NotNull public static CacheControl setPublic()
      Sets 'public'.
    • sMaxAge

      @Stability(Stable) @NotNull public static CacheControl sMaxAge(@NotNull Duration t)
      Sets 's-maxage=invalid input: '<'duration-in-seconds>'.

      Parameters:
      t - This parameter is required.
    • getValue

      @Stability(Stable) @NotNull public Object getValue()
      The raw cache control setting.