Class CacheControl.Builder

java.lang.Object
io.micronaut.http.cachecontrol.CacheControl.Builder
Enclosing class:
CacheControl

public static final class CacheControl.Builder extends Object
Cache-Control Builder.
  • Method Details

    • proxyRevalidate

      public @NonNull CacheControl.Builder proxyRevalidate()
      Enables proxyRevalidate. If cache is stale, it must revalidate with the proxy before use but only for shared caches.
      Returns:
      The Cache-Control Builder.
    • mustRevalidate

      public @NonNull CacheControl.Builder mustRevalidate()
      Enables mustRevalidate. If cache is stale, it must revalidate with the server before use.
      Returns:
      The Cache-Control Builder.
    • sMaxAge

      public @NonNull CacheControl.Builder sMaxAge(@NonNull Long sMaxAge)
      Parameters:
      sMaxAge - How long (in seconds) the response is considered fresh for shared (e.g., CDN) caches.
      Returns:
      The Cache-Control Builder.
    • sMaxAge

      public @NonNull CacheControl.Builder sMaxAge(@NonNull Duration sMaxAge)
      Parameters:
      sMaxAge - How long (in seconds) the response is considered fresh for shared (e.g., CDN) caches.
      Returns:
      The Cache-Control Builder.
    • maxAge

      public @NonNull CacheControl.Builder maxAge(@NonNull Long maxAge)
      Parameters:
      maxAge - How long (in seconds) the response is considered fresh.
      Returns:
      The Cache-Control Builder.
    • maxAge

      public @NonNull CacheControl.Builder maxAge(@NonNull Duration maxAge)
      Parameters:
      maxAge - How long the response is considered fresh.
      Returns:
      The Cache-Control Builder.
    • inmutable

      public @NonNull CacheControl.Builder inmutable()
      Sets Cache-Control as inmmutable. It indicates the response won't change, so no revalidation is needed.
      Returns:
      The Cache-Control Builder.
    • publicDirective

      public @NonNull CacheControl.Builder publicDirective()
      The public response directive indicates that the response can be stored in a shared cache.
      Returns:
      The Cache-Control Builder.
    • privateDirective

      public @NonNull CacheControl.Builder privateDirective()
      The private response directive indicates that the response can be stored only in a private cache (e.g. local caches in browsers).
      Returns:
      The Cache-Control Builder.
    • noStore

      public @NonNull CacheControl.Builder noStore()
      Returns:
      The Cache-Control Builder.
    • noCache

      public @NonNull CacheControl.Builder noCache()
      Returns:
      The Cache-Control Builder.
    • mustUnderstand

      public @NonNull CacheControl.Builder mustUnderstand()
      Returns:
      The Cache-Control Builder.
    • noTransform

      public @NonNull CacheControl.Builder noTransform()
      Returns:
      The Cache-Control Builder.
    • staleWhileRevalidate

      public @NonNull CacheControl.Builder staleWhileRevalidate(@NonNull Duration staleWhileRevalidate)
      Parameters:
      staleWhileRevalidate - Stale while revalidate duration
      Returns:
      The Cache-Control Builder.
    • staleWhileRevalidate

      public @NonNull CacheControl.Builder staleWhileRevalidate(@NonNull Long seconds)
      Parameters:
      seconds - Stale while revalidate seconds
      Returns:
      The Cache-Control Builder.
    • staleIfError

      public @NonNull CacheControl.Builder staleIfError(@NonNull Duration staleIfError)
      Parameters:
      staleIfError - Stale if error duration
      Returns:
      The Cache-Control Builder.
    • staleIfError

      public @NonNull CacheControl.Builder staleIfError(@NonNull Long seconds)
      Parameters:
      seconds - Stale if error seconds
      Returns:
      The Cache-Control Builder.
    • build

      public @NonNull CacheControl build()
      Returns:
      A Cache-Control