| 此版本仍在开发中,尚不被认为是稳定的。对于最新的稳定版本,请使用 Spring Boot 3.5.5! | 
缓存 (caches)
这cachesendpoint 提供对应用程序缓存的访问。
检索所有缓存
要检索应用程序的缓存,请将GET请求/actuator/caches,如以下基于 curl 的示例所示:
$ 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"
        }
      }
    }
  }
}按名称检索缓存
要按名称检索缓存,请将GET请求/actuator/caches/{name},如以下基于 curl 的示例所示:
$ 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
{
  "cacheManager" : "cacheManager",
  "name" : "cities",
  "target" : "java.util.concurrent.ConcurrentHashMap"
}逐出所有缓存
要清除所有可用的缓存,请将DELETE请求/actuator/caches如以下基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/caches' -i -X DELETE按名称逐出缓存
要逐出特定缓存,请将DELETE请求/actuator/caches/{name}如以下基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/caches/countries?cacheManager=anotherCacheManager' -i -X DELETE \
    -H 'Content-Type: application/x-www-form-urlencoded'| 由于有两个名为 countries这cacheManager必须提供以指定哪个Cache应该被清除。 |