public final class ClientCacheControl extends CacheControl
| Modifier and Type | Field and Description |
|---|---|
static ClientCacheControl |
EMPTY
An empty instance with all directives disabled.
|
static ClientCacheControl |
FORCE_CACHE
"only-if-cached, max-stale=2147483647". |
static ClientCacheControl |
FORCE_NETWORK
"no-cache". |
| Modifier and Type | Method and Description |
|---|---|
String |
asHeaderValue()
Encodes the directives in this
CacheControl into an HTTP "cache-control" header value. |
static ClientCacheControlBuilder |
builder()
Returns a newly created
ClientCacheControlBuilder with all directived disabled initially. |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
hasMaxStale()
Returns whether the
"max-stale" directive is enabled. |
boolean |
isEmpty()
Returns
true if all directives are disabled. |
long |
maxStaleSeconds()
Returns the value of the
"max-stale" directive or -1 if disabled or the value is not
specified. |
long |
minFreshSeconds()
Returns the value of the
"min-fresh" directive or -1 if disabled. |
boolean |
onlyIfCached()
Returns whether the
"only-if-cached" directive is enabled. |
static ClientCacheControl |
parse(Iterable<String> directives)
Parses the specified
"cache-control" header values into a ClientCacheControl. |
static ClientCacheControl |
parse(String... directives)
Parses the specified
"cache-control" header values into a ClientCacheControl. |
long |
staleIfErrorSeconds()
Returns the value of the
"stale-if-error" directive or -1 if disabled. |
long |
staleWhileRevalidateSeconds()
Returns the value of the
"stale-while-revalidate" directive or -1 if disabled. |
ClientCacheControlBuilder |
toBuilder()
Returns a newly created
ClientCacheControlBuilder which has the same initial directives with
this ClientCacheControl. |
maxAgeSeconds, noCache, noStore, noTransform, toStringpublic static final ClientCacheControl EMPTY
public static final ClientCacheControl FORCE_NETWORK
"no-cache".public static final ClientCacheControl FORCE_CACHE
"only-if-cached, max-stale=2147483647".public static ClientCacheControl parse(String... directives)
"cache-control" header values into a ClientCacheControl.
Note that any unknown directives will be ignored.ClientCacheControl decoded from the specified header values.public static ClientCacheControl parse(Iterable<String> directives)
"cache-control" header values into a ClientCacheControl.
Note that any unknown directives will be ignored.ClientCacheControl decoded from the specified header values.public static ClientCacheControlBuilder builder()
ClientCacheControlBuilder with all directived disabled initially.public boolean isEmpty()
CacheControltrue if all directives are disabled.isEmpty in class CacheControlpublic boolean onlyIfCached()
"only-if-cached" directive is enabled.public boolean hasMaxStale()
"max-stale" directive is enabled.maxStaleSeconds()public long maxStaleSeconds()
"max-stale" directive or -1 if disabled or the value is not
specified.hasMaxStale()public long minFreshSeconds()
"min-fresh" directive or -1 if disabled.public long staleWhileRevalidateSeconds()
"stale-while-revalidate" directive or -1 if disabled.public long staleIfErrorSeconds()
"stale-if-error" directive or -1 if disabled.public ClientCacheControlBuilder toBuilder()
ClientCacheControlBuilder which has the same initial directives with
this ClientCacheControl.toBuilder in class CacheControlpublic String asHeaderValue()
CacheControlCacheControl into an HTTP "cache-control" header value.asHeaderValue in class CacheControl"cache-control" header value, or an empty string if no directives were enabled.public boolean equals(Object o)
equals in class CacheControlpublic int hashCode()
hashCode in class CacheControlCopyright © 2020 LeanCloud. All rights reserved.