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.104.0 (build e79254c)", date="2024-11-22T02:24:08.954Z") @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.maxAge(Duration.days(365)), CacheControl.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.maxAge(Duration.seconds(0))))
         .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.
    • immutable

      @Stability(Stable) @NotNull public static CacheControl immutable()
      Sets 'immutable'.
    • 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'.
    • mustUnderstand

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

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

      @Stability(Stable) @NotNull public static CacheControl noStore()
      Sets 'no-store'.
    • 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.
    • staleIfError

      @Stability(Stable) @NotNull public static CacheControl staleIfError(@NotNull Duration t)
      Sets 'stale-if-error=invalid input: '<'duration-in-seconds>'.

      Parameters:
      t - This parameter is required.
    • staleWhileRevalidate

      @Stability(Stable) @NotNull public static CacheControl staleWhileRevalidate(@NotNull Duration t)
      Sets 'stale-while-revalidate=invalid input: '<'duration-in-seconds>'.

      Parameters:
      t - This parameter is required.
    • getValue

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