2011-05-10 79 views
3

我期待到Oracle Coherence的一个客户,和他们有兴趣越来越统计信息,回明白使用模式等如何从Coherence缓存中获取统计信息?

我知道我可以从JMX的一些信息的事情之一,然而还有一个我想从中获取数据的CacheStatistics接口。但是我看不到我应该如何从缓存对象获取其统计信息。

下面的代码是我的poc实现,我可以使用“缓存”对象来放置并从缓存中获取值,有没有办法从缓存链接到相关的统计数据?我想我失去了一些东西简单的地方...

NamedCache cache = CacheFactory.getCache(cacheName); 
    if(cache.isActive()){ 
      //Wrong because there's no link to the cache.. 
     SimpleCacheStatistics scs = new SimpleCacheStatistics(); 

     long hits = scs.getCacheHits(); 
     System.out.println("Cache hits:" +hits+"\n : "+scs.toString()); 
    } 
+0

链接到API将很方便。 – 2011-05-10 13:21:40

+0

对不起,在这里你去:http://download.oracle.com/docs/cd/E18686_01/coh.37/e18683/toc.htm – MrChris 2011-05-10 13:27:48

回答

0

如果缓存是nearcache,那么你可以做的following.Also检查API来获取backcache看到它的统计数据。

if (cache instanceof NearCache) { 
    System.out.println("\tstatistics :" + ((LocalCache)((NearCache)cache).getFrontMap()).getCacheStatistics()); 
} 
+1

本地缓存getCacheStatistics()已弃用。有没有其他方法可以获得统计信息? – Nishu 2015-12-07 14:42:26

相关问题