ehcache

net.sf.ehcache.management
Interface CacheStatisticsMBean

All Known Implementing Classes:
CacheStatistics

public interface CacheStatisticsMBean

Since:
1.3
Version:
$Id: CacheStatisticsMBean.java 6907 2013-01-18 16:16:39Z cdennis $
Author:
Greg Luck

Method Summary
 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()
           
 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
 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()
          Gets the number of elements stored in the cache.
 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.
 

Method Detail

getCacheHits

long getCacheHits()
The number of times a requested item was found in the cache.

Returns:
the number of times a requested item was found in the cache

getInMemoryHits

long getInMemoryHits()
Number of times a requested item was found in the Memory Store.

Returns:
the number of times a requested item was found in memory

getOffHeapHits

long getOffHeapHits()
Number of times a requested item was found in the off-heap store.

Returns:
the number of times a requested item was found off-heap, or 0 if there is no BigMemory storage configured.

getOnDiskHits

long getOnDiskHits()
Number of times a requested item was found in the Disk Store.

Returns:
the number of times a requested item was found on Disk, or 0 if there is no disk storage configured.

getCacheMisses

long getCacheMisses()
Returns:
the number of times a requested element was not found in the cache

getInMemoryMisses

long getInMemoryMisses()
Returns:
the number of times a requested element was not found in the memory cache

getOffHeapMisses

long getOffHeapMisses()
Returns:
the number of times a requested element was not found in the off-heap cache

getOnDiskMisses

long getOnDiskMisses()
Returns:
the number of times a requested element was not found in the disk cache

getObjectCount

long getObjectCount()
Gets the number of elements stored in the cache. Caclulating this can be expensive. Accordingly, this method will return three different values, depending on the statistics accuracy setting.

Best Effort Size

This result is returned when the statistics accuracy setting is Statistics.

The size is the number of Elements in the MemoryStore plus the number of Elements in the DiskStore.

This number is the actual number of elements, including expired elements that have not been removed. Any duplicates between stores are accounted for.

Expired elements are removed from the the memory store when getting an expired element, or when attempting to spool an expired element to disk.

Expired elements are removed from the disk store when getting an expired element, or when the expiry thread runs, which is once every five minutes.

Guaranteed Accuracy Size

This result is returned when the statistics accuracy setting is Statistics.

This method accounts for elements which might be expired or duplicated between stores. It take approximately 200ms per 1000 elements to execute.

Fast but non-accurate Size

This result is returned when the statistics accuracy setting is Statistics.

The number given may contain expired elements. In addition if the DiskStore is used it may contain some double counting of elements. It takes 6ms for 1000 elements to execute. Time to execute is O(log n). 50,000 elements take 36ms.

Returns:
the number of elements in the ehcache, with a varying degree of accuracy, depending on accuracy setting.

getMemoryStoreObjectCount

long getMemoryStoreObjectCount()
Gets the number of objects in the MemoryStore

Returns:
the MemoryStore size which is always a count unadjusted for duplicates or expiries

getOffHeapStoreObjectCount

long getOffHeapStoreObjectCount()
Gets the number of objects in the OffHeapStore

Returns:
the OffHeapStore size which is always a count unadjusted for duplicates or expiries

getDiskStoreObjectCount

long getDiskStoreObjectCount()
Gets the number of objects in the DiskStore

Returns:
the DiskStore size which is always a count unadjusted for duplicates or expiries

getAssociatedCacheName

String getAssociatedCacheName()
Returns:
the name of the Ehcache, or null is there no associated cache

getCacheHitPercentage

double getCacheHitPercentage()
Returns the percentage of cache accesses that found a requested item in the cache.

Returns:
the percentage of successful hits

getCacheMissPercentage

double getCacheMissPercentage()
Returns the percentage of cache accesses that did not find a requested element in the cache.

Returns:
the percentage of accesses that failed to find anything

getInMemoryHitPercentage

double getInMemoryHitPercentage()
Returns the percentage of cache accesses that found a requested item cached in-memory.

Returns:
the percentage of successful hits from the MemoryStore

getOffHeapHitPercentage

double getOffHeapHitPercentage()
Returns the percentage of cache accesses that found a requested item cached off-heap.

Returns:
the percentage of successful hits from the OffHeapStore

getOnDiskHitPercentage

double getOnDiskHitPercentage()
Returns the percentage of cache accesses that found a requested item cached on disk.

Returns:
the percentage of successful hits from the DiskStore.

getWriterQueueLength

long getWriterQueueLength()
Gets the size of the write-behind queue, if any. The value is for all local buckets

Returns:
Elements waiting to be processed by the write behind writer. -1 if no write-behind

getWriterMaxQueueSize

int getWriterMaxQueueSize()
Gets the maximum size of the write-behind queue, if any.

Returns:
Maximum elements waiting to be processed by the write behind writer. -1 if no write-behind

ehcache

Copyright 2001-2015, Terracotta, Inc.