Search code examples
javaignite

Apache Ignite: Possible to get a caches last read time


Below java code to access cache metrics which I have enabled.

       IgniteCache<Integer, String> cache = ignite.cache("testCache);
            CacheMetrics cacheMetrics = cache.metrics();

Within cacheMetrics it does not seem to hold the last time the cache has and a read on any entry within the cache, it is possible to this?

Edit: Maybe this is a clue on the https://apacheignite.readme.io/docs/rest-api#section-cache-metrics I can see in the example response a read time;

{
  "affinityNodeId": "",
  "error": "",
  "response": {
    "createTime": 1415179251551,
    "hits": 0,
    "misses": 0,
    "readTime": 1415179251551,
    "reads": 0,
    "writeTime": 1415179252198,
    "writes": 2
  },
  "successStatus": 0
}

1) Is this the last read time? 2) How can I access this through java?


Solution

  • There are no such metrics like createTime, readTime, writeTime in rest api anymore. Documentation already changed.

    You can add your own listener for event EVT_CACHE_QUERY_OBJECT_READ and create read time metric in your code.