0

是否有任何方法或任何参数可用于查找要缓存的命中数。我们将 Ehcache 用于我们的应用程序。感谢在这方面的任何帮助。

4

1 回答 1

2

你看过 Cache.getStatistics() 吗?

http://ehcache.org/apidocs/net/sf/ehcache/Cache.html#getStatistics () http://ehcache.org/apidocs/net/sf/ehcache/Statistics.html

Cache cache = cacheManager.getCache("someCache");
Statistics stats = cache.getStatistics();

long hits  = stats.getInMemoryHits();
long misses = stats.getInMemoryMisses();
于 2012-06-22T06:22:25.600 回答