缓存 (caches)
caches 端点提供了对应用程序缓存的访问。
检索所有缓存
要检索应用程序的缓存,可以按照以下基于 curl 的示例,向 /actuator/caches 发起一个 GET 请求:
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"
}
}
}
}
}
按名称检索缓存
要按名称检索缓存,可以按照以下基于 curl 的示例,向 /actuator/caches/{name} 发起一个 GET 请求:
curl 'http://localhost:8080/actuator/caches/cities' -i -X GET
上述示例检索了名为 cities 的缓存的信息。返回的响应类似于以下内容:
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 的示例,向 /actuator/caches 发起一个 DELETE 请求:
curl 'http://localhost:8080/actuator/caches' -i -X DELETE