public final class CacheControl
extends java.lang.Object
See RFC 7234, 5.2.
Modifier and Type | Class and Description |
---|---|
static class |
CacheControl.Builder
Builds a
Cache-Control request header. |
Modifier and Type | Field and Description |
---|---|
static CacheControl |
FORCE_CACHE
Cache control request directives that uses the cache only, even if the cached response is
stale.
|
static CacheControl |
FORCE_NETWORK
Cache control request directives that require network validation of responses.
|
(package private) java.lang.String |
headerValue |
private boolean |
immutable |
private boolean |
isPrivate |
private boolean |
isPublic |
private int |
maxAgeSeconds |
private int |
maxStaleSeconds |
private int |
minFreshSeconds |
private boolean |
mustRevalidate |
private boolean |
noCache |
private boolean |
noStore |
private boolean |
noTransform |
private boolean |
onlyIfCached |
private int |
sMaxAgeSeconds |
Modifier | Constructor and Description |
---|---|
private |
CacheControl(boolean noCache,
boolean noStore,
int maxAgeSeconds,
int sMaxAgeSeconds,
boolean isPrivate,
boolean isPublic,
boolean mustRevalidate,
int maxStaleSeconds,
int minFreshSeconds,
boolean onlyIfCached,
boolean noTransform,
boolean immutable,
java.lang.String headerValue) |
(package private) |
CacheControl(CacheControl.Builder builder) |
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
headerValue() |
boolean |
immutable() |
boolean |
isPrivate() |
boolean |
isPublic() |
int |
maxAgeSeconds()
The duration past the response's served date that it can be served without validation.
|
int |
maxStaleSeconds() |
int |
minFreshSeconds() |
boolean |
mustRevalidate() |
boolean |
noCache()
In a response, this field's name "no-cache" is misleading.
|
boolean |
noStore()
If true, this response should not be cached.
|
boolean |
noTransform() |
boolean |
onlyIfCached()
This field's name "only-if-cached" is misleading.
|
static CacheControl |
parse(Headers headers)
Returns the cache directives of
headers . |
int |
sMaxAgeSeconds()
The "s-maxage" directive is the max age for shared caches.
|
java.lang.String |
toString() |
public static final CacheControl FORCE_NETWORK
public static final CacheControl FORCE_CACHE
504 Unsatisfiable Request
.private final boolean noCache
private final boolean noStore
private final int maxAgeSeconds
private final int sMaxAgeSeconds
private final boolean isPrivate
private final boolean isPublic
private final boolean mustRevalidate
private final int maxStaleSeconds
private final int minFreshSeconds
private final boolean onlyIfCached
private final boolean noTransform
private final boolean immutable
@Nullable java.lang.String headerValue
private CacheControl(boolean noCache, boolean noStore, int maxAgeSeconds, int sMaxAgeSeconds, boolean isPrivate, boolean isPublic, boolean mustRevalidate, int maxStaleSeconds, int minFreshSeconds, boolean onlyIfCached, boolean noTransform, boolean immutable, @Nullable java.lang.String headerValue)
CacheControl(CacheControl.Builder builder)
public boolean noCache()
In a request, it means do not use a cache to satisfy the request.
public boolean noStore()
public int maxAgeSeconds()
public int sMaxAgeSeconds()
public boolean isPrivate()
public boolean isPublic()
public boolean mustRevalidate()
public int maxStaleSeconds()
public int minFreshSeconds()
public boolean onlyIfCached()
public boolean noTransform()
public boolean immutable()
public static CacheControl parse(Headers headers)
headers
. This honors both Cache-Control and Pragma
headers if they are present.public java.lang.String toString()
toString
in class java.lang.Object
private java.lang.String headerValue()