Operations Basics / Version 2207
Table Of ContentsTo clear the cache and remove all cached entries, make a POST
request to /actuator/cache
with a JSON body as
in the following example:
curl -X POST -H "Content-Type: application/json" \ -d '{"clear": true}' \ http://localhost:8081/actuator/cache
The response includes a message stating that the cache was cleared, and the state of the cache afterwards, as it
would be returned by a GET
request to the same URL. The following example just shows the start of the response body:
Response.
{ "message": "Cache cleared", "result": { "cacheClasses": { "ALWAYS_STAY_IN_CACHE": { "capacity": 9223372036854775807, "level": 0, "href": "http://localhost:8081/actuator/cache/ALWAYS_STAY_IN_CACHE" }, ...
To clear the cache for a single cache class only, a similar POST
request can be made to /actuator/cache/<cacheClass>
as in the following example:
curl -X POST -H "Content-Type: application/json" \ -d '{"clear": true}' \ http://localhost:8081/actuator/cache/java.lang.Object
Again, the response includes a message about the operation and the state of the cache class afterwards:
Response.
{ "message": "Cache cleared for cache class 'java.lang.Object'.", "result": { "capacity": 10000, "level": 0 } }