java.lang.Object
org.miaixz.bus.http.cache.CacheControl.Builder
- Enclosing class:
CacheControl
A builder for creating
Cache-Control request headers.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newCacheControlinstance.Indicates that the response will not be updated while it's fresh.Sets the maximum age of a cached response.Accept cached responses that have exceeded their freshness lifetime by at mostmaxStale.Sets the minimum number of seconds that a response will continue to be fresh for.noCache()Do not accept a cached response without validation.noStore()Do not store the server's response in any cache.Do not accept a transformed response.Only accept the response from the cache.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
noCache
Do not accept a cached response without validation.- Returns:
- this builder.
-
noStore
Do not store the server's response in any cache.- Returns:
- this builder.
-
maxAge
Sets the maximum age of a cached response. If the cached response is older thanmaxAge, it will not be used and a network request will be made.- Parameters:
maxAge- a non-negative integer. It is stored and transmitted withTimeUnit.SECONDSprecision; finer precision will be lost.timeUnit- the unit ofmaxAge.- Returns:
- this builder.
-
maxStale
Accept cached responses that have exceeded their freshness lifetime by at mostmaxStale. If unspecified, stale cached responses will not be used.- Parameters:
maxStale- a non-negative integer. It is stored and transmitted withTimeUnit.SECONDSprecision; finer precision will be lost.timeUnit- the unit ofmaxStale.- Returns:
- this builder.
-
minFresh
Sets the minimum number of seconds that a response will continue to be fresh for. If the response will be stale by the time it is received, a network request will be made.- Parameters:
minFresh- a non-negative integer. It is stored and transmitted withTimeUnit.SECONDSprecision; finer precision will be lost.timeUnit- the unit ofminFresh.- Returns:
- this builder.
-
onlyIfCached
Only accept the response from the cache.- Returns:
- this builder.
-
noTransform
Do not accept a transformed response.- Returns:
- this builder.
-
immutable
Indicates that the response will not be updated while it's fresh.- Returns:
- this builder.
-
build
Builds a newCacheControlinstance.- Returns:
- a new
CacheControlinstance.
-