Package org.miaixz.bus.http.cache
Class CacheStrategy
java.lang.Object
org.miaixz.bus.http.cache.CacheStrategy
给定一个请求和缓存的响应,这将确定是使用网络、缓存还是两者都使用 选择缓存策略可能会向请求添加条件(比如条件get的“if - modified - since”报头) 或向缓存的响应添加警告(如果缓存的数据可能过时)
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisCacheable(Response response, Request request) 如果response可以存储为以后服务另一个请求,则返回true
-
Field Details
-
networkRequest
请求在网络上发送,如果调用不使用网络则为空 -
cacheResponse
缓存响应以返回或验证;如果这个调用不使用缓存,则为null
-
-
Method Details
-
isCacheable
如果response可以存储为以后服务另一个请求,则返回true- Parameters:
response- 相应信息request- 请求信息- Returns:
- the true/false
-