@MXBean public interface CacheStatisticsMXBean
Statistics are accumulated from the time a cache is created. They can be reset
to zero using clear()
.
There are no defined consistency semantics for statistics. Refer to the implementation for precise semantics.
Each cache's statistics object must be registered with an ObjectName that is unique and has the following type and attributes:
Type:
javax.cache:type=CacheStatistics
Required Attributes:
Modifier and Type | Method | Description |
---|---|---|
void |
clear() |
Clears the statistics counters to 0 for the associated Cache.
|
float |
getAverageGetTime() |
The mean time to execute gets.
|
float |
getAveragePutTime() |
The mean time to execute puts.
|
float |
getAverageRemoveTime() |
The mean time to execute removes.
|
long |
getCacheEvictions() |
The total number of evictions from the cache.
|
long |
getCacheGets() |
The total number of requests to the cache.
|
float |
getCacheHitPercentage() |
This is a measure of cache efficiency.
|
long |
getCacheHits() |
The number of get requests that were satisfied by the cache.
|
long |
getCacheMisses() |
A miss is a get request that is not satisfied.
|
float |
getCacheMissPercentage() |
Returns the percentage of cache accesses that did not find a requested entry
in the cache.
|
long |
getCachePuts() |
The total number of puts to the cache.
|
long |
getCacheRemovals() |
The total number of removals from the cache.
|
void clear()
long getCacheHits()
Cache.containsKey(Object)
is not a get request for
statistics purposes.
In a caches with multiple tiered storage, a hit may be implemented as a hit to the cache or to the first tier.
For an EntryProcessor
, a hit occurs when the
key exists and an entry processor can be invoked against it, even if no
methods of Cache.Entry
or
MutableEntry
are called.
float getCacheHitPercentage()
It is calculated as:
getCacheHits()
divided by ()
* 100.
long getCacheMisses()
In a simple cache a miss occurs when the cache does not satisfy the request.
Cache.containsKey(Object)
is not a get request for
statistics purposes.
For an EntryProcessor
, a miss occurs when the
key does not exist and therefore an entry processor cannot be invoked
against it.
In a caches with multiple tiered storage, a miss may be implemented as a miss to the cache or to the first tier.
In a read-through cache a miss is an absence of the key in the cache that will trigger a call to a CacheLoader. So it is still a miss even though the cache will load and return the value.
Refer to the implementation for precise semantics.
float getCacheMissPercentage()
This is calculated as getCacheMisses()
divided by
getCacheGets()
* 100.
long getCacheGets()
A "get" is an operation that returns the current or previous value. It does not include checking for the existence of a key.
In a caches with multiple tiered storage, a gets may be implemented as a get to the cache or to the first tier.
long getCachePuts()
A put is counted even if it is immediately evicted.
Replaces, where a put occurs which overrides an existing mapping is counted as a put.
long getCacheRemovals()
long getCacheEvictions()
float getAverageGetTime()
In a read-through cache the time taken to load an entry on miss is not included in get time.
float getAveragePutTime()
float getAverageRemoveTime()
Copyright © 2017. All rights reserved.