Package com.linecorp.armeria.common
Class ServerCacheControl
java.lang.Object
com.linecorp.armeria.common.CacheControl
com.linecorp.armeria.common.ServerCacheControl
Directives for HTTP caching mechanisms in responses.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ServerCacheControl
"no-cache, no-store, must-revalidate"
.static final ServerCacheControl
An empty instance with all directives disabled.static final ServerCacheControl
"max-age=31536000, public, immutable"
.static final ServerCacheControl
"no-cache, must-revalidate"
. -
Method Summary
Modifier and TypeMethodDescriptionEncodes the directives in thisCacheControl
into an HTTP"cache-control"
header value.static ServerCacheControlBuilder
builder()
Returns a newly createdServerCacheControlBuilder
with all directives disabled initially.boolean
Returns whether the"private"
directive is enabled.boolean
Returns whether the"public"
directive is enabled.boolean
int
hashCode()
boolean
Returns whether the"immutable"
directive is enabled.boolean
isEmpty()
Returnstrue
if all directives are disabled.boolean
Returns whether the"must-revalidate"
directive is enabled.static ServerCacheControl
Parses the specified"cache-control"
header values into aServerCacheControl
.static ServerCacheControl
Parses the specified"cache-control"
header values into aServerCacheControl
.boolean
Returns whether the"proxy-revalidate"
directive is enabled.long
Returns the value of the"s-maxage"
directive or-1
if disabled.Returns a newly createdServerCacheControlBuilder
which has the same initial directives with thisServerCacheControl
.Methods inherited from class com.linecorp.armeria.common.CacheControl
maxAgeSeconds, noCache, noStore, noTransform, toString
-
Field Details
-
EMPTY
An empty instance with all directives disabled. -
DISABLED
"no-cache, no-store, must-revalidate"
. -
REVALIDATED
"no-cache, must-revalidate"
. -
IMMUTABLE
"max-age=31536000, public, immutable"
.
-
-
Method Details
-
parse
Parses the specified"cache-control"
header values into aServerCacheControl
. Note that any unknown directives will be ignored.- Returns:
- the
ServerCacheControl
decoded from the specified header values.
-
parse
Parses the specified"cache-control"
header values into aServerCacheControl
. Note that any unknown directives will be ignored.- Returns:
- the
ServerCacheControl
decoded from the specified header values.
-
builder
Returns a newly createdServerCacheControlBuilder
with all directives disabled initially. -
isEmpty
public boolean isEmpty()Description copied from class:CacheControl
Returnstrue
if all directives are disabled.- Overrides:
isEmpty
in classCacheControl
-
cachePublic
public boolean cachePublic()Returns whether the"public"
directive is enabled. -
cachePrivate
public boolean cachePrivate()Returns whether the"private"
directive is enabled. -
immutable
public boolean immutable()Returns whether the"immutable"
directive is enabled. -
mustRevalidate
public boolean mustRevalidate()Returns whether the"must-revalidate"
directive is enabled. -
proxyRevalidate
public boolean proxyRevalidate()Returns whether the"proxy-revalidate"
directive is enabled. -
sMaxAgeSeconds
public long sMaxAgeSeconds()Returns the value of the"s-maxage"
directive or-1
if disabled. -
toBuilder
Returns a newly createdServerCacheControlBuilder
which has the same initial directives with thisServerCacheControl
.- Specified by:
toBuilder
in classCacheControl
-
asHeaderValue
Description copied from class:CacheControl
Encodes the directives in thisCacheControl
into an HTTP"cache-control"
header value.- Specified by:
asHeaderValue
in classCacheControl
- Returns:
- the
"cache-control"
header value, or an empty string if no directives were enabled.
-
equals
- Overrides:
equals
in classCacheControl
-
hashCode
public int hashCode()- Overrides:
hashCode
in classCacheControl
-