VMware GemFire Java API Reference
Interface CacheStatistics
-
public interface CacheStatisticsDefines 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:
Region.getStatistics(),Region.Entry.getStatistics()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longgetHitCount()Returns the number of hits for this region or entry.floatgetHitRatio()Return the hit ratio, a convenience method defined as the ratio of hits to the number of calls toRegion.get.longgetLastAccessedTime()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.longgetLastModifiedTime()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.longgetMissCount()Returns the number of times thatRegion.geton the region or the entry was called and there was no value found locally.voidresetCounts()Reset the missCount and hitCount to zero for this entry.
-
-
-
Method Detail
-
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:
Region.put(Object, Object),Region.get(Object),Region.create(Object, Object),Region.createSubregion(java.lang.String, org.apache.geode.cache.RegionAttributes<SK, SV>)
-
getLastAccessedTime
long getLastAccessedTime() throws StatisticsDisabledExceptionFor 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:
Region.get(Object),getLastModifiedTime()
-
getMissCount
long getMissCount() throws StatisticsDisabledExceptionReturns 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
long getHitCount() throws StatisticsDisabledExceptionReturns 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
float getHitRatio() throws StatisticsDisabledExceptionReturn 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
void resetCounts() throws StatisticsDisabledExceptionReset the missCount and hitCount to zero for this entry.- Throws:
StatisticsDisabledException- if statistics are not available
-
-