Package com.linecorp.armeria.common
Class ClientCacheControl
java.lang.Object
com.linecorp.armeria.common.CacheControl
com.linecorp.armeria.common.ClientCacheControl
Directives for HTTP caching mechanisms in requests.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ClientCacheControl
An empty instance with all directives disabled.static final ClientCacheControl
"only-if-cached, max-stale=2147483647"
.static final ClientCacheControl
"no-cache"
. -
Method Summary
Modifier and TypeMethodDescriptionEncodes the directives in thisCacheControl
into an HTTP"cache-control"
header value.static ClientCacheControlBuilder
builder()
Returns a newly createdClientCacheControlBuilder
with all directives disabled initially.boolean
int
hashCode()
boolean
Returns whether the"max-stale"
directive is enabled.boolean
isEmpty()
Returnstrue
if all directives are disabled.long
Returns the value of the"max-stale"
directive or-1
if disabled or the value is not specified.long
Returns the value of the"min-fresh"
directive or-1
if disabled.boolean
Returns whether the"only-if-cached"
directive is enabled.static ClientCacheControl
Parses the specified"cache-control"
header values into aClientCacheControl
.static ClientCacheControl
Parses the specified"cache-control"
header values into aClientCacheControl
.long
Returns the value of the"stale-if-error"
directive or-1
if disabled.long
Returns the value of the"stale-while-revalidate"
directive or-1
if disabled.Returns a newly createdClientCacheControlBuilder
which has the same initial directives with thisClientCacheControl
.Methods inherited from class com.linecorp.armeria.common.CacheControl
maxAgeSeconds, noCache, noStore, noTransform, toString
-
Field Details
-
EMPTY
An empty instance with all directives disabled. -
FORCE_NETWORK
"no-cache"
. -
FORCE_CACHE
"only-if-cached, max-stale=2147483647"
.
-
-
Method Details
-
parse
Parses the specified"cache-control"
header values into aClientCacheControl
. Note that any unknown directives will be ignored.- Returns:
- the
ClientCacheControl
decoded from the specified header values.
-
parse
Parses the specified"cache-control"
header values into aClientCacheControl
. Note that any unknown directives will be ignored.- Returns:
- the
ClientCacheControl
decoded from the specified header values.
-
builder
Returns a newly createdClientCacheControlBuilder
with all directives disabled initially. -
isEmpty
public boolean isEmpty()Description copied from class:CacheControl
Returnstrue
if all directives are disabled.- Overrides:
isEmpty
in classCacheControl
-
onlyIfCached
public boolean onlyIfCached()Returns whether the"only-if-cached"
directive is enabled. -
hasMaxStale
public boolean hasMaxStale()Returns whether the"max-stale"
directive is enabled.- See Also:
-
maxStaleSeconds
public long maxStaleSeconds()Returns the value of the"max-stale"
directive or-1
if disabled or the value is not specified.- See Also:
-
minFreshSeconds
public long minFreshSeconds()Returns the value of the"min-fresh"
directive or-1
if disabled. -
staleWhileRevalidateSeconds
public long staleWhileRevalidateSeconds()Returns the value of the"stale-while-revalidate"
directive or-1
if disabled. -
staleIfErrorSeconds
public long staleIfErrorSeconds()Returns the value of the"stale-if-error"
directive or-1
if disabled. -
toBuilder
Returns a newly createdClientCacheControlBuilder
which has the same initial directives with thisClientCacheControl
.- 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
-