Top Description Methods
javax.cache.management

public Interface CacheStatisticsMXBean

Annotations
@MXBean
Imports
javax.management.MXBean

Cache statistics.

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:

Author
Greg Luck
Since
1.0

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Clears the statistics counters to 0 for the associated Cache.

public float

Returns:

the time in µs
getAverageGetTime
()

The mean time to execute gets.

public float

Returns:

the time in µs
getAveragePutTime
()

The mean time to execute puts.

public float

Returns:

the time in µs
getAverageRemoveTime
()

The mean time to execute removes.

public long

Returns:

the number of evictions
getCacheEvictions
()

The total number of evictions from the cache.

public long

Returns:

the number of gets
getCacheGets
()

The total number of requests to the cache.

public float

Returns:

the percentage of successful hits, as a decimal e.g 75.
getCacheHitPercentage
()

This is a measure of cache efficiency.

public long

Returns:

the number of hits
getCacheHits
()

The number of get requests that were satisfied by the cache.

public long

Returns:

the number of misses
getCacheMisses
()

A miss is a get request that is not satisfied.

public float

Returns:

the percentage of accesses that failed to find anything
getCacheMissPercentage
()

Returns the percentage of cache accesses that did not find a requested entry in the cache.

public long

Returns:

the number of puts
getCachePuts
()

The total number of puts to the cache.

public long

Returns:

the number of removals
getCacheRemovals
()

The total number of removals from the cache.

Method Detail

clearback to summary
public void clear()

Clears the statistics counters to 0 for the associated Cache.

getAverageGetTimeback to summary
public float getAverageGetTime()

The mean time to execute gets.

In a read-through cache the time taken to load an entry on miss is not included in get time.

Returns:float

the time in µs

getAveragePutTimeback to summary
public float getAveragePutTime()

The mean time to execute puts.

Returns:float

the time in µs

getAverageRemoveTimeback to summary
public float getAverageRemoveTime()

The mean time to execute removes.

Returns:float

the time in µs

getCacheEvictionsback to summary
public long getCacheEvictions()

The total number of evictions from the cache. An eviction is a removal initiated by the cache itself to free up space. An eviction is not treated as a removal and does not appear in the removal counts.

Returns:long

the number of evictions

getCacheGetsback to summary
public long getCacheGets()

The total number of requests to the cache. This will be equal to the sum of the hits and misses.

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.

Returns:long

the number of gets

getCacheHitPercentageback to summary
public float getCacheHitPercentage()

This is a measure of cache efficiency.

It is calculated as: getCacheHits divided by () * 100.

Returns:float

the percentage of successful hits, as a decimal e.g 75.

getCacheHitsback to summary
public long getCacheHits()

The number of get requests that were satisfied by the cache.

javax.cache.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 javax.cache.processor.EntryProcessor, a hit occurs when the key exists and an entry processor can be invoked against it, even if no methods of javax.cache.Cache.Entry or javax.cache.processor.MutableEntry are called.

Returns:long

the number of hits

getCacheMissesback to summary
public long getCacheMisses()

A miss is a get request that is not satisfied.

In a simple cache a miss occurs when the cache does not satisfy the request.

javax.cache.Cache#containsKey(Object) is not a get request for statistics purposes.

For an javax.cache.processor.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.

Returns:long

the number of misses

getCacheMissPercentageback to summary
public float getCacheMissPercentage()

Returns the percentage of cache accesses that did not find a requested entry in the cache.

This is calculated as getCacheMisses() divided by getCacheGets() * 100.

Returns:float

the percentage of accesses that failed to find anything

getCachePutsback to summary
public long getCachePuts()

The total number of puts to the cache.

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.

Returns:long

the number of puts

getCacheRemovalsback to summary
public long getCacheRemovals()

The total number of removals from the cache. This does not include evictions, where the cache itself initiates the removal to make space.

Returns:long

the number of removals