public static final class CacheControl.Builder extends Object
Cache-Control request header.
| Constructor and Description |
|---|
Builder()
|
| Modifier and Type | Method and Description |
|---|---|
CacheControl |
build()
|
CacheControl |
maxAge(int maxAge, TimeUnit
Sets the maximum age of a cached response.
|
CacheControl |
maxStale(int maxStale, TimeUnit
Accept cached responses that have exceeded their freshness lifetime by up to
maxStale.
|
CacheControl |
minFresh(int minFresh, TimeUnit
Sets the minimum number of seconds that a response will continue to be fresh for.
|
CacheControl |
noCache()
Don't accept an unvalidated cached response.
|
CacheControl |
noStore()
Don't store the server's response in any cache.
|
CacheControl |
noTransform()
Don't accept a transformed response.
|
CacheControl |
onlyIfCached()
Only accept the response if it is in the cache.
|
public CacheControl.Builder noCache()
public CacheControl.Builder noStore()
public CacheControl.Builder maxAge(int maxAge, 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, 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, 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 CacheControlbuild()