Class ClientCacheControlBuilder

java.lang.Object
com.linecorp.armeria.common.ClientCacheControlBuilder

public final class ClientCacheControlBuilder
extends Object
Creates a new ClientCacheControl using the builder pattern.

 ClientCacheControl cacheControl =
     ClientCacheControl.builder().noCache().build();
 
See Also:
ServerCacheControlBuilder, Cache-Control (MDN), Why is Cache-Control header sent in a request?
  • Method Details

    • onlyIfCached

      public ClientCacheControlBuilder onlyIfCached()
      Enables the "only-if-cached" directive.
    • onlyIfCached

      public ClientCacheControlBuilder onlyIfCached​(boolean onlyIfCached)
      Enables or disables the "only-if-cached" directive.
      Parameters:
      onlyIfCached - true to enable or false to disable.
    • maxStale

      public ClientCacheControlBuilder maxStale()
      Enables the "max-stale directive without a value.
    • maxStale

      public ClientCacheControlBuilder maxStale​(boolean maxStale)
      Enables or disables the "max-stale" directive.
      Parameters:
      maxStale - true to enable without a value or false to disable.
    • maxStale

      public ClientCacheControlBuilder maxStale​(@Nullable Duration maxStale)
      Enables or disables the "max-stale" directive.
      Parameters:
      maxStale - the value of the directive to enable, or null to disable.
    • maxStaleSeconds

      public ClientCacheControlBuilder maxStaleSeconds​(long maxStaleSeconds)
      Enables the "max-stale" directive.
      Parameters:
      maxStaleSeconds - the value in seconds.
    • minFresh

      public ClientCacheControlBuilder minFresh​(@Nullable Duration minFresh)
      Enables or disables the "min-fresh" directive.
      Parameters:
      minFresh - the value of the directive to enable, or null to disable.
    • minFreshSeconds

      public ClientCacheControlBuilder minFreshSeconds​(long minFreshSeconds)
      Enables the "min-fresh" directive.
      Parameters:
      minFreshSeconds - the value in seconds.
    • staleWhileRevalidate

      public ClientCacheControlBuilder staleWhileRevalidate​(@Nullable Duration staleWhileRevalidate)
      Enables or disables the "stale-while-revalidate" directive.
      Parameters:
      staleWhileRevalidate - the value of the directive to enable, or null to disable.
    • staleWhileRevalidateSeconds

      public ClientCacheControlBuilder staleWhileRevalidateSeconds​(long staleWhileRevalidateSeconds)
      Enables the "stale-while-revalidate" directive.
      Parameters:
      staleWhileRevalidateSeconds - the value in seconds.
    • staleIfError

      public ClientCacheControlBuilder staleIfError​(@Nullable Duration staleIfError)
      Enables or disables the "stale-if-error" directive.
      Parameters:
      staleIfError - the value of the directive to enable, or null to disable.
    • staleIfErrorSeconds

      public ClientCacheControlBuilder staleIfErrorSeconds​(long staleIfErrorSeconds)
      Enables the "stale-if-error" directive.
      Parameters:
      staleIfErrorSeconds - the value in seconds.
    • build

      public ClientCacheControl build()
      Returns a newly created ClientCacheControl with the directives enabled so far.
    • noCache

      public ClientCacheControlBuilder noCache()
      Enables the "no-cache" directive.
    • noCache

      public ClientCacheControlBuilder noCache​(boolean noCache)
      Enables or disables the "no-cache" directive.
      Parameters:
      noCache - true to enable or false to disable.
    • noStore

      public ClientCacheControlBuilder noStore()
      Enables the "no-store" directive.
    • noStore

      public ClientCacheControlBuilder noStore​(boolean noStore)
      Enables or disables the "no-store" directive.
      Parameters:
      noStore - true to enable or false to disable.
    • noTransform

      public ClientCacheControlBuilder noTransform()
      Enables the "no-transform" directive.
    • noTransform

      public ClientCacheControlBuilder noTransform​(boolean noTransform)
      Enables or disables the "no-transform" directive.
      Parameters:
      noTransform - true to enable or false to disable.
    • maxAge

      public ClientCacheControlBuilder maxAge​(@Nullable Duration maxAge)
      Enables or disables the "max-age" directive.
      Parameters:
      maxAge - the value of the directive to enable, or null to disable.
    • maxAgeSeconds

      public ClientCacheControlBuilder maxAgeSeconds​(long maxAgeSeconds)
      Enables the "max-age" directive.
      Parameters:
      maxAgeSeconds - the value in seconds.