Class ServerCacheControlBuilder

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

public final class ServerCacheControlBuilder
extends Object
Creates a new ServerCacheControl using the builder pattern.

 ServerCacheControl cacheControl =
     ServerCacheControl.builder()
                       .noCache()
                       .noStore()
                       .mustRevalidate()
                       .build();
 
See Also:
ClientCacheControlBuilder, HTTP Caching (Google), Cache-Control (MDN)
  • Method Details

    • cachePublic

      public ServerCacheControlBuilder cachePublic()
      Enables the "public" directive.
    • cachePublic

      public ServerCacheControlBuilder cachePublic​(boolean cachePublic)
      Enables or disables the "public" directive.
      Parameters:
      cachePublic - true to enable or false to disable.
    • cachePrivate

      public ServerCacheControlBuilder cachePrivate()
      Enables the "private" directive.
    • cachePrivate

      public ServerCacheControlBuilder cachePrivate​(boolean cachePrivate)
      Enables or disables the "private" directive.
      Parameters:
      cachePrivate - true to enable or false to disable.
    • immutable

      public ServerCacheControlBuilder immutable()
      Enables the "immutable" directive.
    • immutable

      public ServerCacheControlBuilder immutable​(boolean immutable)
      Enables or disables the "immutable" directive.
      Parameters:
      immutable - true to enable or false to disable.
    • mustRevalidate

      public ServerCacheControlBuilder mustRevalidate()
      Enables the "must-revalidate" directive.
    • mustRevalidate

      public ServerCacheControlBuilder mustRevalidate​(boolean mustRevalidate)
      Enables or disables the "must-revalidate" directive.
      Parameters:
      mustRevalidate - true to enable or false to disable.
    • proxyRevalidate

      public ServerCacheControlBuilder proxyRevalidate()
      Enables the "proxy-revalidate" directive.
    • proxyRevalidate

      public ServerCacheControlBuilder proxyRevalidate​(boolean proxyRevalidate)
      Enables or disables the "proxy-revalidate" directive.
      Parameters:
      proxyRevalidate - true to enable or false to disable.
    • sMaxAge

      public ServerCacheControlBuilder sMaxAge​(@Nullable Duration sMaxAge)
      Enables or disables the "s-maxage" directive.
      Parameters:
      sMaxAge - the value of the directive to enable, or null to disable.
    • sMaxAgeSeconds

      public ServerCacheControlBuilder sMaxAgeSeconds​(long sMaxAgeSeconds)
      Enables the "s-maxage" directive.
      Parameters:
      sMaxAgeSeconds - the value in seconds.
    • build

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

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

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

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

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

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

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

      public ServerCacheControlBuilder 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 ServerCacheControlBuilder maxAgeSeconds​(long maxAgeSeconds)
      Enables the "max-age" directive.
      Parameters:
      maxAgeSeconds - the value in seconds.