Package com.linecorp.armeria.common
Class ServerCacheControlBuilder
- java.lang.Object
-
- com.linecorp.armeria.common.ServerCacheControlBuilder
-
public final class ServerCacheControlBuilder extends Object
Creates a newServerCacheControl
using the builder pattern.ServerCacheControl cacheControl = new ServerCacheControlBuilder() .noCache() .noStore() .mustRevalidate() .build();
-
-
Constructor Summary
Constructors Constructor Description ServerCacheControlBuilder()
Deprecated.
-
Method Summary
Modifier and Type Method Description ServerCacheControl
build()
Returns a newly createdServerCacheControl
with the directives enabled so far.ServerCacheControlBuilder
cachePrivate()
Enables the"private"
directive.ServerCacheControlBuilder
cachePrivate(boolean cachePrivate)
Enables or disables the"private"
directive.ServerCacheControlBuilder
cachePublic()
Enables the"public"
directive.ServerCacheControlBuilder
cachePublic(boolean cachePublic)
Enables or disables the"public"
directive.ServerCacheControlBuilder
immutable()
Enables the"immutable"
directive.ServerCacheControlBuilder
immutable(boolean immutable)
Enables or disables the"immutable"
directive.ServerCacheControlBuilder
maxAge(Duration maxAge)
Enables or disables the"max-age"
directive.ServerCacheControlBuilder
maxAgeSeconds(long maxAgeSeconds)
Enables the"max-age"
directive.ServerCacheControlBuilder
mustRevalidate()
Enables the"must-revalidate"
directive.ServerCacheControlBuilder
mustRevalidate(boolean mustRevalidate)
Enables or disables the"must-revalidate"
directive.ServerCacheControlBuilder
noCache()
Enables the"no-cache"
directive.ServerCacheControlBuilder
noCache(boolean noCache)
Enables or disables the"no-cache"
directive.ServerCacheControlBuilder
noStore()
Enables the"no-store"
directive.ServerCacheControlBuilder
noStore(boolean noStore)
Enables or disables the"no-store"
directive.ServerCacheControlBuilder
noTransform()
Enables the"no-transform"
directive.ServerCacheControlBuilder
noTransform(boolean noTransform)
Enables or disables the"no-transform"
directive.ServerCacheControlBuilder
proxyRevalidate()
Enables the"proxy-revalidate"
directive.ServerCacheControlBuilder
proxyRevalidate(boolean proxyRevalidate)
Enables or disables the"proxy-revalidate"
directive.ServerCacheControlBuilder
sMaxAge(Duration sMaxAge)
Enables or disables the"s-maxage"
directive.ServerCacheControlBuilder
sMaxAgeSeconds(long sMaxAgeSeconds)
Enables the"s-maxage"
directive.
-
-
-
Constructor Detail
-
ServerCacheControlBuilder
@Deprecated public ServerCacheControlBuilder()
Deprecated.Creates a new builder with all directives disabled initially.
-
-
Method Detail
-
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 orfalse
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 orfalse
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 orfalse
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 orfalse
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 orfalse
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, ornull
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 createdServerCacheControl
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 orfalse
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 orfalse
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 orfalse
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, ornull
to disable.
-
maxAgeSeconds
public ServerCacheControlBuilder maxAgeSeconds(long maxAgeSeconds)
Enables the"max-age"
directive.- Parameters:
maxAgeSeconds
- the value in seconds.
-
-