Package org.miaixz.bus.http.cache
Class CacheControl
java.lang.Object
org.miaixz.bus.http.cache.CacheControl
缓存控制头,带有来自服务器或客户端的缓存指令。 这些指令设置了哪些响应可以存储,以及哪些请求可以由存储的响应来满足的策略
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CacheControl仅使用缓存的缓存控制请求指令,即使缓存的响应已过期。static final CacheControl需要对响应进行网络验证的缓存控制请求指令。 -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanbooleanisPublic()intintintbooleanbooleannoCache()booleannoStore()booleanbooleanstatic CacheControl返回headers的缓存指令。inttoString()
-
Field Details
-
FORCE_NETWORK
需要对响应进行网络验证的缓存控制请求指令。请注意,缓存可以通过有条件的GET请求来辅助这些请求. -
FORCE_CACHE
仅使用缓存的缓存控制请求指令,即使缓存的响应已过期。如果响应在缓存中不可用, 或者需要服务器验证,调用将失败
-
-
Method Details
-
parse
返回headers的缓存指令。 如果存在Cache-Control和Pragma头文件,则会同时显示它们- Parameters:
headers- headers- Returns:
- 缓存控制头
-
noCache
public boolean noCache() -
noStore
public boolean noStore() -
maxAgeSeconds
public int maxAgeSeconds() -
sMaxAgeSeconds
public int sMaxAgeSeconds() -
isPrivate
public boolean isPrivate() -
isPublic
public boolean isPublic() -
mustRevalidate
public boolean mustRevalidate() -
maxStaleSeconds
public int maxStaleSeconds() -
minFreshSeconds
public int minFreshSeconds() -
onlyIfCached
public boolean onlyIfCached() -
noTransform
public boolean noTransform() -
immutable
public boolean immutable() -
toString
-