快取 (caches)
caches 端點提供對應用程式快取的訪問。
檢索所有快取
要檢索應用程式的快取,請向 /actuator/caches 傳送 GET 請求,如以下基於 curl 的示例所示:
$ curl 'https://: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"
}
}
}
}
}
按名稱檢索快取
要按名稱檢索快取,請向 /actuator/caches/{name} 傳送 GET 請求,如以下基於 curl 的示例所示:
$ curl 'https://: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
{
"cacheManager" : "cacheManager",
"name" : "cities",
"target" : "java.util.concurrent.ConcurrentHashMap"
}
逐出所有快取
要清除所有可用快取,請向 /actuator/caches 傳送 DELETE 請求,如以下基於 curl 的示例所示:
$ curl 'https://:8080/actuator/caches' -i -X DELETE