public static final class CacheControl.Builder
extends java.lang.Object
Cache-Control
request header.Constructor and Description |
---|
CacheControl.Builder() |
Modifier and Type | Method and Description |
---|---|
CacheControl |
build() |
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.
|
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 build()
Copyright © 2014. All Rights Reserved.