close

Filter

loading table of contents...

Operations Basics / Version 2207

Table Of Contents

4.10.3.3 Browsing Cache Entries

To view cache entries for a cache class or CacheKey, use the endpoint’s entries query parameter by making a GET request to /actuator/cache/<cacheClass>?entries=true or /actuator/cache/<cacheClass>/<CacheKey>?entries=true.

Note, that the endpoint implementation has to scan all cache entries to find matching entries. For large caches, this can be expensive, because the cache is temporarily locked against updates.

The following example requests entries for content properties that are cached internally by the Unified API:

curl http://localhost:8081/actuator/cache/com.coremedia.cap.heap/com.coremedia.cotopaxi.content.PropertiesKey?entries=true

The response body starts like this:

Response. 

{
  "count": 3327,
  "level": 27444160,
  "entries": {
    "total": 3327,
    "offset": 0,
    "limit": 10,
    "elements": [
      {
        "keyClass": "com.coremedia.cotopaxi.content.PropertiesKey",
        "keyToString": "key.properties(448)",
        "weight": 432696,
        "dependencies": {
          "total": 1,
          "offset": 0,
          "limit": 10,
          "elements": [
            {
              "class": "com.coremedia.cotopaxi.content.PropertiesDependency",
              "toString": "dependency.properties(coremedia:///cap/content/448)"
            }
          ]
        },
        "dependents": {
          "total": 0,
          "offset": 0,
          "limit": 10,
          "elements": []
        }
      },
      {
        "keyClass": "com.coremedia.cotopaxi.content.PropertiesKey",
        "keyToString": "key.properties(202)",
        "weight": 80150,
...

The actual response is longer and shows the first 10 cache entries of 3327 in total, sorted by descending weight, so that the entry that occupies the most space in the cache comes first. Each entry is listed with the name of its CacheKey class (keyClass) , the #toString representation of the CacheKey object (keyToString), the space it occupies in the cache (weight), its dependencies and dependents.

You can control the output with additional optional query parameters:

Query ParameterDefaultDescription

values

false

Set to true to include the class and toString representation of cached values in the response.

entriesSort

weight desc

Sort criteria for returned entries.

Possible values are weight, keyClass, keyToString, dependencies (number of) and dependents (number of).

The sort direction can be specified by appending a space character followed by asc for ascending or desc for descending sort. The default sort direction is ascending.

Multi-level sorting can be specified by comma-separated values, for example url-encoded query parameter entriesSort=keyClass+asc,weight+desc would sort by ascending CacheKey class, while equal key classes would be sorted by descending weight.

entriesOffset

0

The number of cache entries to skip.

entriesLimit

10

The maximum number of cache entries to return.

dependenciesOffset

0

For each cache entry, the number of dependencies to skip.

dependenciesLimit

10

For each cache entry, the maximum number of dependencies to return.

dependentsOffset

0

For each cache entry, the number of dependents to skip.

dependentsLimit

10

For each cache entry, the maximum number of dependents to return.

stringLimit

200

For the string representation of keys, dependencies and values, the maximum length before strings get shortened in the response. Set to 0 to not return string representations.

Note, that the endpoint calls CacheKey#toString, the #toString method of dependency objects, and if values=true, the #toString method of cached values. Depending on the implementation of #toString methods, these can be expensive operations. You can avoid that #toString methods are called by setting query parameter stringLimit to 0 and not using the keyToString sort criteria.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.