Another question from the Gitter chat. Why the cache.metrics().cacheHits is 0, even if I do call cache.get(key) and it returns a stored value from the cache? How it can be?
<http://apache-ignite-users.70518.x6.nabble.com/file/n4769/Cache_metrics.png> metrics.size returns 1, but also metrics.isEmpty returns true Do I need somehow to enable the metrics? For the image above, I've used SpringCacheManager to enable Read Through cache on my datastore repository. While I was trying to reproduce simpler setup locally (without SpringCacheManager), like the one below: package experiments.ignite; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.Ignition; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; public class CacheMetrics { public static void main(final String[] args) throws InterruptedException { final CacheConfiguration<String, Integer> cacheConfiguration = new CacheConfiguration<>("sample"); final IgniteConfiguration igniteConfiguration = new IgniteConfiguration() .setGridName("experiments") .setMetricsUpdateFrequency(1) // every millisecond .setCacheConfiguration(cacheConfiguration); final Ignite ignite = Ignition.start(igniteConfiguration); final IgniteCache<String, Integer> cache = ignite.cache("sample"); cache.put("a", (int) 'a'); final int value = cache.get("a"); assert value == 97; @SuppressWarnings("unused") final Integer missing = cache.get("z"); assert cache.metrics().getCacheHits() == 0; assert cache.metrics().getCacheMisses() == 0; assert cache.metrics().getSize() == 1; assert !cache.metrics().isEmpty(); } } It worked fine (i.e. isEmpty() is false now), but still both cacheHits and cacheMisses are 0. -- View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cache-metrics-cache-hits-and-misses-are-0-also-isEmpty-in-inconsistent-state-with-getSize-tp4769.html Sent from the Apache Ignite Users mailing list archive at Nabble.com.