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.
| Modifier and Type | Field and Description |
|---|---|
| private transient Ehcache | |
| private final ObjectName | |
| private static final long | |
| private StatisticsGateway |
| Access | Constructor and Description |
|---|---|
| public | CacheStatistics(Ehcache
the backing ehcache ehcache)Constructs an object from an ehcache statistics object |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static ObjectName | createObjectName(String cacheManagerName, String cacheName)
Creates an object name using the scheme "net.sf.ehcache:type=CacheStatistics,CacheManager=<cachemanagername>,name=<cachename>" |
| public String | Returns: the name of the Ehcache, or null is there no associated cacheImplements net. |
| public double | getCacheHitPercentage()
Implements net. |
| public long | getCacheHits()
Implements net. |
| public long | Returns: the number of times a requested element was not found in the cacheImplements net. |
| public double | getCacheMissPercentage()
Implements net. |
| public long | Returns: the DiskStore size which is always a count unadjusted for duplicates or expiriesImplements net. |
| public Ehcache | Returns: the backing cache, if one is connected. On Serialization the transient Ehcache reference is dropped.Return the backing cache. |
| public double | getInMemoryHitPercentage()
Implements net. |
| public long | Returns: the number of times a requested item was found in memoryImplements net. |
| public long | |
| public long | Returns: the MemoryStore size which is always a count unadjusted for duplicates or expiriesImplements net. |
| public long | Returns: the number of elements in the ehcache, with a varying degree of accuracy, depending on accuracy setting.Implements net. |
| pack-priv ObjectName | |
| public double | getOffHeapHitPercentage()
Implements net. |
| public long | Returns: the number of times a requested item was found in off-heapImplements net. |
| public long | |
| public long | getOffHeapStoreObjectCount()
Implements net. |
| public double | getOnDiskHitPercentage()
Implements net. |
| public long | Returns: the number of times a requested item was found on Disk, or 0 if there is no disk storage configured.Implements net. |
| public long | |
| private static double | |
| public int | getWriterMaxQueueSize()
Implements net. |
| public long | Returns: Elements waiting to be processed by the write behind writer. -1 if no write-behindImplements net. |
| ehcache | back to summary |
|---|---|
| private transient Ehcache ehcache | |
| objectName | back to summary |
|---|---|
| private final ObjectName objectName | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| statistics | back to summary |
|---|---|
| private StatisticsGateway statistics | |
| CacheStatistics | back to summary |
|---|---|
| public CacheStatistics(Ehcache ehcache) Constructs an object from an ehcache statistics object
| |
| createObjectName | back to summary |
|---|---|
| pack-priv static ObjectName createObjectName(String cacheManagerName, String cacheName) Creates an object name using the scheme "net.sf.ehcache:type=CacheStatistics,CacheManager= | |
| getAssociatedCacheName | back to summary |
|---|---|
| public String getAssociatedCacheName() Implements net.
| |
| getCacheHitPercentage | back to summary |
|---|---|
| public double getCacheHitPercentage() Implements net. Doc from net. Returns the percentage of cache accesses that found a requested item in the cache.
| |
| getCacheHits | back to summary |
|---|---|
| public long getCacheHits() Implements net. Doc from net. The number of times a requested item was found in the cache.
| |
| getCacheMisses | back to summary |
|---|---|
| public long getCacheMisses() Implements net. Warning. This statistic is recorded as a long. If the statistic is large than Integer#MAX_VALUE precision will be lost.
| |
| getCacheMissPercentage | back to summary |
|---|---|
| public double getCacheMissPercentage() Implements net. Doc from net. Returns the percentage of cache accesses that did not find a requested element in the cache.
| |
| getDiskStoreObjectCount | back to summary |
|---|---|
| public long getDiskStoreObjectCount() Implements net. Gets the number of objects in the DiskStore
| |
| getEhcache | back to summary |
|---|---|
| public Ehcache getEhcache() Return the backing cache.
| |
| getInMemoryHitPercentage | back to summary |
|---|---|
| public double getInMemoryHitPercentage() Implements net. Doc from net. Returns the percentage of cache accesses that found a requested item cached in-memory.
| |
| getInMemoryHits | back to summary |
|---|---|
| public long getInMemoryHits() Implements net. Number of times a requested item was found in the Memory Store.
| |
| getInMemoryMisses | back to summary |
|---|---|
| public long getInMemoryMisses() Implements net.
| |
| getMemoryStoreObjectCount | back to summary |
|---|---|
| public long getMemoryStoreObjectCount() Implements net. Gets the number of objects in the MemoryStore
| |
| getObjectCount | back to summary |
|---|---|
| public long getObjectCount() Implements net.
| |
| getObjectName | back to summary |
|---|---|
pack-priv ObjectName getObjectName()
| |
| getOffHeapHitPercentage | back to summary |
|---|---|
| public double getOffHeapHitPercentage() Implements net. Doc from net. Returns the percentage of cache accesses that found a requested item cached off-heap.
| |
| getOffHeapHits | back to summary |
|---|---|
| public long getOffHeapHits() Implements net. Number of times a requested item was found in the off-heap store.
| |
| getOffHeapMisses | back to summary |
|---|---|
| public long getOffHeapMisses() Implements net.
| |
| getOffHeapStoreObjectCount | back to summary |
|---|---|
| public long getOffHeapStoreObjectCount() Implements net. Doc from net. Gets the number of objects in the OffHeapStore
| |
| getOnDiskHitPercentage | back to summary |
|---|---|
| public double getOnDiskHitPercentage() Implements net. Doc from net. Returns the percentage of cache accesses that found a requested item cached on disk.
| |
| getOnDiskHits | back to summary |
|---|---|
| public long getOnDiskHits() Implements net. Number of times a requested item was found in the Disk Store.
| |
| getOnDiskMisses | back to summary |
|---|---|
| public long getOnDiskMisses() Implements net.
| |
| getPercentage | back to summary |
|---|---|
| private static double getPercentage(long number, long total) | |
| getWriterMaxQueueSize | back to summary |
|---|---|
| public int getWriterMaxQueueSize() Implements net. Doc from net. Gets the maximum size of the write-behind queue, if any.
| |
| getWriterQueueLength | back to summary |
|---|---|
| public long getWriterQueueLength() Implements net. Gets the size of the write-behind queue, if any. The value is for all local buckets
| |