public Optional < CacheStatistics > getStatistics ( String cacheName ) { javax . cache . Cache cache = cacheManager . getCache ( cacheName ) ; if ( cache == null ) { return Optional . empty ( ) ; } if ( ( ( CompleteConfiguration ) cache . getConfiguration ( CompleteConfiguration . class ) ) . isStatisticsEnabled ( ) && cache instanceof ICache ) { com . hazelcast . cache . CacheStatistics stats = ( ( ICache ) cache ) . getLocalCacheStatistics ( ) ; CacheStatistics statistics = new CacheStatistics ( stats . getCacheHits ( ) , stats . getCacheMisses ( ) , stats . getCacheHitPercentage ( ) , stats . getCacheMissPercentage ( ) , stats . getCacheGets ( ) , stats . getCachePuts ( ) , stats . getCacheRemovals ( ) , stats . getCacheEvictions ( ) , stats . getAverageGetTime ( ) , stats . getAveragePutTime ( ) , stats . getAverageRemoveTime ( ) ) ; return Optional . of ( statistics ) ; } return Optional . empty ( ) ; }
Get a cache statistic information if available