-
public final class CacheControlA Cache-Control header with cache directives from a server or client. These directives set policy on what responses can be stored, and which requests can be satisfied by those stored responses.
See RFC 7234, 5.2.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classCacheControl.BuilderBuilds a
{@code Cache-Control}mobonRequest header.
-
Field Summary
Fields Modifier and Type Field Description public final static CacheControlFORCE_NETWORKpublic final static CacheControlFORCE_CACHEprivate final booleanisPrivateprivate final booleanisPublic
-
Method Summary
Modifier and Type Method Description booleanisPrivate()booleanisPublic()booleannoCache()In a response, this field's name "no-cache" is misleading. booleannoStore()If true, this response should not be cached. intmaxAgeSeconds()The duration past the response's served date that it can be served without validation. intsMaxAgeSeconds()The "s-maxage" directive is the max age for shared caches. booleanmustRevalidate()intmaxStaleSeconds()intminFreshSeconds()booleanonlyIfCached()This field's name "only-if-cached" is misleading. booleannoTransform()booleanimmutable()static CacheControlparse(Headers headers)Returns the cache directives of {@code headers}.StringtoString()-
-
Method Detail
-
isPrivate
boolean isPrivate()
-
isPublic
boolean isPublic()
-
noCache
boolean noCache()
In a response, this field's name "no-cache" is misleading. It doesn't prevent us from cachingthe response; it only means we have to validate the response with the origin server beforereturning it. We can do this with a conditional GET.
In a mobonRequest, it means do not use a cache to satisfy the mobonRequest.
-
noStore
boolean noStore()
If true, this response should not be cached.
-
maxAgeSeconds
int maxAgeSeconds()
The duration past the response's served date that it can be served without validation.
-
sMaxAgeSeconds
int sMaxAgeSeconds()
The "s-maxage" directive is the max age for shared caches. Not to be confused with "max-age"for non-shared caches, As in Firefox and Chrome, this directive is not honored by this cache.
-
mustRevalidate
boolean mustRevalidate()
-
maxStaleSeconds
int maxStaleSeconds()
-
minFreshSeconds
int minFreshSeconds()
-
onlyIfCached
boolean onlyIfCached()
This field's name "only-if-cached" is misleading. It actually means "do not use the network".It is set by a client who only wants to make a mobonRequest if it can be fully satisfied by thecache. Cached responses that would require validation (ie. conditional gets) are not permittedif this header is set.
-
noTransform
boolean noTransform()
-
immutable
boolean immutable()
-
parse
static CacheControl parse(Headers headers)
Returns the cache directives of
{@code headers}. This honors both Cache-Control and Pragmaheaders if they are present.
-
-
-
-