public static final class CacheControl.Builder
extends java.lang.Object
Cache-Control request header.| Modifier and Type | Field and Description |
|---|---|
(package private) boolean |
immutable |
(package private) int |
maxAgeSeconds |
(package private) int |
maxStaleSeconds |
(package private) int |
minFreshSeconds |
(package private) boolean |
noCache |
(package private) boolean |
noStore |
(package private) boolean |
noTransform |
(package private) boolean |
onlyIfCached |
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
CacheControl |
build() |
CacheControl.Builder |
immutable() |
CacheControl.Builder |
maxAge(int maxAge,
java.util.concurrent.TimeUnit timeUnit)
Sets the maximum age of a cached response.
|
CacheControl.Builder |
maxStale(int maxStale,
java.util.concurrent.TimeUnit timeUnit)
Accept cached responses that have exceeded their freshness lifetime by up to
maxStale. |
CacheControl.Builder |
minFresh(int minFresh,
java.util.concurrent.TimeUnit timeUnit)
Sets the minimum number of seconds that a response will continue to be fresh for.
|
CacheControl.Builder |
noCache()
Don't accept an unvalidated cached response.
|
CacheControl.Builder |
noStore()
Don't store the server's response in any cache.
|
CacheControl.Builder |
noTransform()
Don't accept a transformed response.
|
CacheControl.Builder |
onlyIfCached()
Only accept the response if it is in the cache.
|
boolean noCache
boolean noStore
int maxAgeSeconds
int maxStaleSeconds
int minFreshSeconds
boolean onlyIfCached
boolean noTransform
boolean immutable
public CacheControl.Builder noCache()
public CacheControl.Builder noStore()
public CacheControl.Builder maxAge(int maxAge, java.util.concurrent.TimeUnit timeUnit)
maxAge, it will not be used and a network request will be made.maxAge - a non-negative integer. This is stored and transmitted with TimeUnit.SECONDS precision; finer precision will be lost.public CacheControl.Builder maxStale(int maxStale, java.util.concurrent.TimeUnit timeUnit)
maxStale. If unspecified, stale cache responses will not be used.maxStale - a non-negative integer. This is stored and transmitted with TimeUnit.SECONDS precision; finer precision will be lost.public CacheControl.Builder minFresh(int minFresh, java.util.concurrent.TimeUnit timeUnit)
minFresh have elapsed, the cached response will not be
used and a network request will be made.minFresh - a non-negative integer. This is stored and transmitted with TimeUnit.SECONDS precision; finer precision will be lost.public CacheControl.Builder onlyIfCached()
504
Unsatisfiable Request response will be returned.public CacheControl.Builder noTransform()
public CacheControl.Builder immutable()
public CacheControl build()