Operations Basics / Version 2406.0
Table Of ContentsTo change the capacity for a certain cache class, make a POST
request to /actuator/cache/<cacheClass>
with a JSON
body that specifies the capacity for the cache class, as shown in the following example:
curl -X POST -H "Content-Type: application/json" \ -d '{"capacity": 20000}' \ http://localhost:8081/actuator/cache/java.lang.Object
The response includes a message about the performed change, and the new state of the cache class:
Response.
{ "message": "Capacity changed for cache class 'java.lang.Object': 10000 -> 20000", "result": { "capacity": 20000, "level": 107 } }
Note, that setting a smaller capacity for a cache class does not necessarily lead to an immediate eviction of cached
values. If you want to reduce the current cache level with a reduced capacity, you can either make a separate request
to trigger an eviction as described in Section 4.10.3.6, “Trigger Cache Eviction” or make a POST
request with a
JSON body to set both a new capacity and trigger an eviction:
curl -X POST -H "Content-Type: application/json" \ -d '{"capacity": 100, "evict": true}' \ http://localhost:8081/actuator/cache/java.lang.Object
The response includes a message about the performed changes, and the new state of the cache class:
Response.
{ "message": "Capacity changed for cache class 'java.lang.Object': 20000 -> 100; Cache eviction triggered for cache class: 'java.lang.Object'.", "result": { "capacity": 100, "level": 90 } }