Operations Basics / Version 2207
Table Of ContentsTo retrieve all cache classes, make a GET
request to /actuator/cache
:
curl http://localhost:8081/actuator/cache
The JSON response body lists cache classes with their capacity and current level, as in the following example:
Response.
{ "cacheClasses": { "ALWAYS_STAY_IN_CACHE": { "capacity": 9223372036854775807, "level": 26, "href": "http://localhost:8081/actuator/cache/ALWAYS_STAY_IN_CACHE" }, "DIGEST": { "capacity": 9223372036854775807, "level": 0, "href": "http://localhost:8081/actuator/cache/DIGEST" }, "com.coremedia.cap.disk": { "capacity": 10737418240, "level": 0, "href": "http://localhost:8081/actuator/cache/com.coremedia.cap.disk" }, "com.coremedia.cap.heap": { "capacity": 104857600, "level": 88905639, "href": "http://localhost:8081/actuator/cache/com.coremedia.cap.heap" }, "java.lang.Object": { "capacity": 10000, "level": 107, "href": "http://localhost:8081/actuator/cache/java.lang.Object" } } }
The cache classes ALWAYS_STAY_IN_CACHE
and DIGEST
are predefined classes with unlimited capacity.
Cache class com.coremedia.cap.heap
is used for internal caching in the Unified API, with capacity and level being
rough estimates of the required heap memory in byte. Other cache classes may use different units for capacity and level,
and many simply count the number of cached values like the cache class java.lang.Object
, which is configured to hold
up to 10,000 objects in this example.
The "href"
links in the JSON response can be used to get information about a single cache class.
These links are only present if the actuator endpoint is invoked over HTTP. Like many other endpoints, the cache
endpoint may also be exposed and invoked over JMX, in which case the response will not contain such links.
To retrieve the capacity and level of a single cache class, make a GET
request to /actuator/cache/<cacheClass>
, for example:
curl http://localhost:8081/actuator/cache/com.coremedia.cap.heap
The response will look like
Response.
{ "capacity": 104857600, "level": 88905639 }
If the specified cache class is neither configured nor used, then the request will be answered with HTTP status code 404 (Not Found).