public class CacheStatistics extends Object implements CacheStatisticsMBean, Serializable
An immutable Cache statistics implementation}
This is like a value object, with the added ability to clear cache statistics on the cache. That ability does not survive any Serialization of this class. On deserialization the cache can be considered disconnected.
The accuracy of these statistics are determined by the value of {#getStatisticsAccuracy()} at the time the statistic was computed.
Because this class maintains a reference to an Ehcache, any references held to this class will precent the Ehcache from getting garbage collected.
| Constructor and Description |
|---|
CacheStatistics(Ehcache ehcache)
Constructs an object from an ehcache statistics object
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAssociatedCacheName() |
double |
getCacheHitPercentage()
Returns the percentage of cache accesses that found a requested item in the cache.
|
long |
getCacheHits()
The number of times a requested item was found in the cache.
|
long |
getCacheMisses()
Warning.
|
double |
getCacheMissPercentage()
Returns the percentage of cache accesses that did not find a requested element in the cache.
|
long |
getDiskStoreObjectCount()
Gets the number of objects in the DiskStore
|
Ehcache |
getEhcache()
Return the backing cache.
|
double |
getInMemoryHitPercentage()
Returns the percentage of cache accesses that found a requested item cached in-memory.
|
long |
getInMemoryHits()
Number of times a requested item was found in the Memory Store.
|
long |
getInMemoryMisses() |
long |
getMemoryStoreObjectCount()
Gets the number of objects in the MemoryStore
|
long |
getObjectCount() |
double |
getOffHeapHitPercentage()
Returns the percentage of cache accesses that found a requested item cached off-heap.
|
long |
getOffHeapHits()
Number of times a requested item was found in the off-heap store.
|
long |
getOffHeapMisses() |
long |
getOffHeapStoreObjectCount()
Gets the number of objects in the OffHeapStore
|
double |
getOnDiskHitPercentage()
Returns the percentage of cache accesses that found a requested item cached on disk.
|
long |
getOnDiskHits()
Number of times a requested item was found in the Disk Store.
|
long |
getOnDiskMisses() |
int |
getWriterMaxQueueSize()
Gets the maximum size of the write-behind queue, if any.
|
long |
getWriterQueueLength()
Gets the size of the write-behind queue, if any.
|
public CacheStatistics(Ehcache ehcache)
ehcache - the backing ehcachepublic String getAssociatedCacheName()
getAssociatedCacheName in interface CacheStatisticsMBeanpublic long getInMemoryHits()
getInMemoryHits in interface CacheStatisticsMBeanpublic long getOffHeapHits()
getOffHeapHits in interface CacheStatisticsMBeanpublic long getOnDiskHits()
getOnDiskHits in interface CacheStatisticsMBeanpublic long getCacheMisses()
getCacheMisses in interface CacheStatisticsMBeanpublic long getInMemoryMisses()
getInMemoryMisses in interface CacheStatisticsMBeanpublic long getOffHeapMisses()
getOffHeapMisses in interface CacheStatisticsMBeanpublic long getOnDiskMisses()
getOnDiskMisses in interface CacheStatisticsMBeanpublic long getObjectCount()
getObjectCount in interface CacheStatisticsMBeanpublic long getWriterQueueLength()
getWriterQueueLength in interface CacheStatisticsMBeanpublic int getWriterMaxQueueSize()
getWriterMaxQueueSize in interface CacheStatisticsMBeanpublic long getMemoryStoreObjectCount()
getMemoryStoreObjectCount in interface CacheStatisticsMBeanpublic long getOffHeapStoreObjectCount()
getOffHeapStoreObjectCount in interface CacheStatisticsMBeanpublic long getDiskStoreObjectCount()
getDiskStoreObjectCount in interface CacheStatisticsMBeanpublic Ehcache getEhcache()
public double getCacheHitPercentage()
getCacheHitPercentage in interface CacheStatisticsMBeanpublic double getCacheMissPercentage()
getCacheMissPercentage in interface CacheStatisticsMBeanpublic double getInMemoryHitPercentage()
getInMemoryHitPercentage in interface CacheStatisticsMBeanpublic double getOffHeapHitPercentage()
getOffHeapHitPercentage in interface CacheStatisticsMBeanpublic double getOnDiskHitPercentage()
getOnDiskHitPercentage in interface CacheStatisticsMBeanpublic long getCacheHits()
getCacheHits in interface CacheStatisticsMBeanCopyright 2001-2021, Terracotta, Inc.