キャッシュ (caches
)
caches
エンドポイントは、アプリケーションのキャッシュへのアクセスを提供します。
すべてのキャッシュを取得する
アプリケーションのキャッシュを取得するには、次の curl ベースの例に示すように、GET
リクエストを /actuator/caches
に作成します。
$ 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 ベースの例に示すように、GET
リクエストを /actuator/caches/{name}
に作成します。
$ 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 ベースの例に示すように、DELETE
を /actuator/caches
にリクエストします。
$ curl 'http://localhost:8080/actuator/caches' -i -X DELETE
名前によるキャッシュの削除
特定のキャッシュを削除するには、次の curl ベースの例に示すように、DELETE
を /actuator/caches/{name}
にリクエストします。
$ curl 'http://localhost:8080/actuator/caches/countries?cacheManager=anotherCacheManager' -i -X DELETE \
-H 'Content-Type: application/x-www-form-urlencoded'
countries という名前の 2 つのキャッシュがあるため、Cache をクリアする必要があることを指定するには、cacheManager を提供する必要があります。 |