|
对于最新稳定版本,请使用Spring Boot 4.0.0! |
缓存(缓存)
这缓存端点提供对应用程序缓存的访问。
检索所有缓存
要检索应用程序缓存,请获取请求/执行器/缓存如以下基于卷度的示例所示:
$ curl 'http://localhost:8080/actuator/caches' -i -X GET
最终的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 435
{
"cacheManagers" : {
"anotherCacheManager" : {
"caches" : {
"countries" : {
"target" : "java.util.concurrent.ConcurrentHashMap"
}
}
},
"cacheManager" : {
"caches" : {
"cities" : {
"target" : "java.util.concurrent.ConcurrentHashMap"
},
"countries" : {
"target" : "java.util.concurrent.ConcurrentHashMap"
}
}
}
}
}
按名称检索缓存
要按名称检索缓存,请设置获取请求/执行器/缓存/{name}如以下基于卷度的示例所示:
$ curl 'http://localhost:8080/actuator/caches/cities' -i -X GET
前面的例子检索了关于名为城市.
最终的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 113
{
"target" : "java.util.concurrent.ConcurrentHashMap",
"name" : "cities",
"cacheManager" : "cacheManager"
}
驱逐所有缓存
要清除所有可用缓存,请设置删除请求/执行器/缓存如下基于卷度的示例所示:
$ curl 'http://localhost:8080/actuator/caches' -i -X DELETE
按名称驱逐缓存
要驱逐某个缓存,请设置删除请求/执行器/缓存/{name}如下基于卷度的示例所示:
$ curl 'http://localhost:8080/actuator/caches/countries?cacheManager=anotherCacheManager' -i -X DELETE \
-H 'Content-Type: application/x-www-form-urlencoded'
因为有两个名为状态这缓存管理器必须提供以指定哪种情况缓存应该已经清理干净了。 |