java.lang.Object
org.miaixz.bus.http.cache.CacheStrategy
Given a request and a cached response, this class determines whether to use the network, the cache, or both.
Selecting a cache strategy may add conditions to the request (like the "If-Modified-Since" header for conditional
GETs) or warnings to the cached response (if the cached data is potentially stale).
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisCacheable(Response response, Request request) Returns true ifresponsecan be stored to later serve another request.
-
Field Details
-
networkRequest
The request to send on the network, or null if the network is not used. -
cacheResponse
The cached response to return or validate; null if this call does not use the cache.
-
-
Method Details
-
isCacheable
Returns true ifresponsecan be stored to later serve another request.- Parameters:
response- The response to check.request- The request that resulted in the response.- Returns:
trueif the response is cacheable.
-