Java Code Examples for net.sf.ehcache.Ehcache#getStatistics()

The following examples show how to use net.sf.ehcache.Ehcache#getStatistics() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IbisCacheManager.java    From iaf with Apache License 2.0 6 votes vote down vote up
public static void iterateOverStatistics(StatisticsKeeperIterationHandler hski, Object data, int action) throws SenderException {
	if (self==null) {
		return;
	}
	String cacheNames[]=self.cacheManager.getCacheNames();
	for (int i=0;i<cacheNames.length;i++) {
		Object subdata=hski.openGroup(data, cacheNames[i], "cache");
		Ehcache cache=self.cacheManager.getEhcache(cacheNames[i]);
		Statistics stats = cache.getStatistics();
		stats.getAverageGetTime();
		hski.handleScalar(subdata, "CacheHits", stats.getCacheHits());
		hski.handleScalar(subdata, "CacheMisses", stats.getCacheMisses());
		hski.handleScalar(subdata, "EvictionCount", stats.getEvictionCount());
		hski.handleScalar(subdata, "InMemoryHits", stats.getInMemoryHits());
		hski.handleScalar(subdata, "ObjectCount", stats.getObjectCount());
		hski.handleScalar(subdata, "OnDiskHits", stats.getOnDiskHits());
		hski.closeGroup(subdata);
	}
}
 
Example 2
Source File: EhCache2Metrics.java    From micrometer with Apache License 2.0 4 votes vote down vote up
public EhCache2Metrics(Ehcache cache, Iterable<Tag> tags) {
    super(cache, cache.getName(), tags);
    this.stats = cache.getStatistics();
}