/** * {@inheritDoc} */ @Override public long getCacheHitRate() { return cache.getStatistics().cacheHitOperation().rate().value().longValue(); }
/** * {@inheritDoc} */ public long getCacheHitSample() { long count = 0; for (String name : cacheManager.getCacheNames()) { Cache cache = cacheManager.getCache(name); if (cache != null) { count += cache.getStatistics().cacheHitOperation().rate().value().longValue(); } } return count; }
/** * {@inheritDoc} */ @Override public SampledCounter getCacheHitSample() { return new SampledCounterProxy(cache.getStatistics().cacheHitOperation().rate()); }
/** * {@inheritDoc} */ public long getCacheHitRate() { long result = 0; for (String cacheName : getCacheNames()) { Ehcache cache = cacheManager.getEhcache(cacheName); if (cache != null) { long val = cache.getStatistics().cacheHitOperation().rate().value().longValue(); result += val; } } return result; }
/** * {@inheritDoc} */ public Map<String, int[]> getRegionCacheSamples() { Map<String, int[]> rv = new HashMap<String, int[]>(); for (String name : cacheManager.getCacheNames()) { Cache cache = cacheManager.getCache(name); if (cache != null) { rv.put(name, new int[] {cache.getStatistics().cacheHitOperation().rate().value().intValue() , cache.getStatistics().cacheMissNotFoundOperation().rate().value().intValue() , cache.getStatistics().cacheMissExpiredOperation().rate().value().intValue() , cache.getStatistics().cachePutOperation().rate().value().intValue()}); } } return rv; }
/** * {@inheritDoc} */ @Override public long getCacheHitRate() { return cache.getStatistics().cacheHitOperation().rate().value().longValue(); }
/** * {@inheritDoc} */ @Override public long getCacheHitRate() { return cache.getStatistics().cacheHitOperation().rate().value().longValue(); }
private void saveLocalCache(Cache cache) { cache.getStatistics().cacheHitOperation().count().history() .stream() .collect(Collectors.groupingBy( o -> DateTimeUtils.ofPattern(o.getTimestamp(), FORMATTER_FOR_GROUPING) )) .values() .stream() .map(list -> list.stream().max(Comparator.comparingLong(Timestamped::getTimestamp)).orElse(null)) .filter(Objects::nonNull) .forEach(cacheHistory -> { Map<String, Timestamped<Long>> map = this.storage.getOrDefault(cache.getName(), new HashMap<>()); map.put(DateTimeUtils.ofPattern(cacheHistory.getTimestamp(), FORMATTER_FOR_GROUPING), cacheHistory); if (map.size() > 3) { String removeKey = map.entrySet().stream().min(Comparator.comparingLong(o -> o.getValue().getTimestamp())).map(Map.Entry::getKey).orElse(""); map.remove(removeKey); } this.storage.put(cache.getName(), map); }); }
/** * {@inheritDoc} */ public long getCacheHitSample() { long count = 0; for (String name : cacheManager.getCacheNames()) { Cache cache = cacheManager.getCache(name); if (cache != null) { count += cache.getStatistics().cacheHitOperation().rate().value().longValue(); } } return count; }
/** * {@inheritDoc} */ public long getCacheHitSample() { long count = 0; for (String name : cacheManager.getCacheNames()) { Cache cache = cacheManager.getCache(name); if (cache != null) { count += cache.getStatistics().cacheHitOperation().rate().value().longValue(); } } return count; }
/** * {@inheritDoc} */ @Override public SampledCounter getCacheHitSample() { return new SampledCounterProxy(cache.getStatistics().cacheHitOperation().rate()); }
/** * {@inheritDoc} */ @Override public SampledCounter getCacheHitSample() { return new SampledCounterProxy(cache.getStatistics().cacheHitOperation().rate()); }
/** * {@inheritDoc} */ public long getCacheHitRate() { long result = 0; for (String cacheName : getCacheNames()) { Ehcache cache = cacheManager.getEhcache(cacheName); if (cache != null) { long val = cache.getStatistics().cacheHitOperation().rate().value().longValue(); result += val; } } return result; }
/** * {@inheritDoc} */ public long getCacheHitRate() { long result = 0; for (String cacheName : getCacheNames()) { Ehcache cache = cacheManager.getEhcache(cacheName); if (cache != null) { long val = cache.getStatistics().cacheHitOperation().rate().value().longValue(); result += val; } } return result; }
/** * {@inheritDoc} */ public Map<String, int[]> getRegionCacheSamples() { Map<String, int[]> rv = new HashMap<String, int[]>(); for (String name : cacheManager.getCacheNames()) { Cache cache = cacheManager.getCache(name); if (cache != null) { rv.put(name, new int[] {cache.getStatistics().cacheHitOperation().rate().value().intValue() , cache.getStatistics().cacheMissNotFoundOperation().rate().value().intValue() , cache.getStatistics().cacheMissExpiredOperation().rate().value().intValue() , cache.getStatistics().cachePutOperation().rate().value().intValue()}); } } return rv; }
/** * {@inheritDoc} */ public Map<String, int[]> getRegionCacheSamples() { Map<String, int[]> rv = new HashMap<String, int[]>(); for (String name : cacheManager.getCacheNames()) { Cache cache = cacheManager.getCache(name); if (cache != null) { rv.put(name, new int[] {cache.getStatistics().cacheHitOperation().rate().value().intValue() , cache.getStatistics().cacheMissNotFoundOperation().rate().value().intValue() , cache.getStatistics().cacheMissExpiredOperation().rate().value().intValue() , cache.getStatistics().cachePutOperation().rate().value().intValue()}); } } return rv; }
Cache cache = new MockCache(this.statisticsGateway, "Cache1", 100, false, false, 0L, 0L); when(this.cacheManager.getCache("Cache1")).thenReturn(cache); when(statisticsGateway.cacheHitOperation()).thenReturn(result); when(result.count()).thenReturn(statistic); when(statistic.history()).thenReturn(