Package org.apache.geode.cache
Interface CacheStatistics
public interface CacheStatistics
Defines common statistics information for both region and entries. All of these methods may throw
a CacheClosedException, RegionDestroyedException or an EntryDestroyedException.
- Since:
- GemFire 2.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionlongReturns the number of hits for this region or entry.floatReturn the hit ratio, a convenience method defined as the ratio of hits to the number of calls toRegion.get.longFor an entry, returns the last time it was accessed viaRegion.get; for a region, the last time any of its entries or the entries of its subregions were accessed withRegion.get.longFor an entry, returns the time that the entry's value was last modified; for a region, the last time any of the region's entries' values or the values in subregions' entries were modified.longReturns the number of times thatRegion.geton the region or the entry was called and there was no value found locally.voidReset the missCount and hitCount to zero for this entry.
-
Method Details
-
getLastModifiedTime
long getLastModifiedTime()For an entry, returns the time that the entry's value was last modified; for a region, the last time any of the region's entries' values or the values in subregions' entries were modified. The modification may have been initiated locally or it may have been an update distributed from another cache. It may also have been a new value provided by a loader. The modification time on a region is propagated upward to parent regions, transitively, to the root region.The number is expressed as the number of milliseconds since January 1, 1970. The granularity may be as course as 100ms, so the accuracy may be off by up to 50ms.
Entry and subregion creation will update the modification time on a region, but
destroy,destroyRegion,invalidate, andinvalidateRegiondo not update the modification time.- Returns:
- the last modification time of the region or the entry; returns 0 if entry is invalid or modification time is uninitialized.
- See Also:
-
getLastAccessedTime
For an entry, returns the last time it was accessed viaRegion.get; for a region, the last time any of its entries or the entries of its subregions were accessed withRegion.get. Any modifications will also update the lastAccessedTime, solastAccessedTimeis always>= lastModifiedTime. ThelastAccessedTimeon a region is propagated upward to parent regions, transitively, to the the root region.The number is expressed as the number of milliseconds since January 1, 1970. The granularity may be as course as 100ms, so the accuracy may be off by up to 50ms.
- Returns:
- the last access time of the region or the entry's value; returns 0 if entry is invalid or access time is uninitialized.
- Throws:
StatisticsDisabledException- if statistics are not available- See Also:
-
getMissCount
Returns the number of times thatRegion.geton the region or the entry was called and there was no value found locally. UnlikelastAccessedTime, the miss count is not propagated to parent regions. Note that remote operations such as a "net search" do not effect the miss count.- Returns:
- the number of cache misses on the region or the entry.
- Throws:
StatisticsDisabledException- if statistics are not available
-
getHitCount
Returns the number of hits for this region or entry. The number of hits is defined as the number of times when theRegion.getfinds a value locally. UnlikelastAccessedTime, the hit count is not propagated to parent regions. Note that remote operations such as a "net search" do not effect the hit count.- Returns:
- the number of hits for this region or entry.
- Throws:
StatisticsDisabledException- if statistics are not available
-
getHitRatio
Return the hit ratio, a convenience method defined as the ratio of hits to the number of calls toRegion.get. If there have been zero calls toRegion.get, then zero is returned.The hit ratio is equivalent to:
long hitCount = getHitCount(); long total = hitCount + getMissCount(); return total == 0L ? 0.0f : ((float) hitCount / total);
- Returns:
- the hit ratio as a float
- Throws:
StatisticsDisabledException- if statistics are not available
-
resetCounts
Reset the missCount and hitCount to zero for this entry.- Throws:
StatisticsDisabledException- if statistics are not available
-