Cache. Instances of this class are immutable.
Cache statistics are incremented according to the following rules:
hitCount is incremented.
missCount and loadSuccessCount
are incremented, and the total loading time, in nanoseconds, is added to totalLoadTime.
missCount and loadExceptionCount are incremented, and the total loading time, in nanoseconds, is
added to totalLoadTime.
missCount.
evictionCount is incremented.
A lookup is specifically defined as an invocation of one of the methods LoadingCache#get(Object), LoadingCache#getUnchecked(Object), Cache#get(Object,
Callable), or LoadingCache#getAll(Iterable).
| Modifier and Type | Field and Description |
|---|---|
| private final long | |
| private final long | |
| private final long | |
| private final long | |
| private final long | |
| private final long |
| Access | Constructor and Description |
|---|---|
| public | CacheStats(long hitCount, long missCount, long loadSuccessCount, long loadExceptionCount, long totalLoadTime, long evictionCount)
Constructs a new |
| Modifier and Type | Method and Description |
|---|---|
| public double | |
| public boolean | equals(Object
the reference object with which to compare. object)Overrides java. |
| public long | |
| public int | |
| public long | |
| public double | |
| public long | |
| public long | loadExceptionCount()
Returns the number of times |
| public double | |
| public long | loadSuccessCount()
Returns the number of times |
| public CacheStats | minus(CacheStats other)
Returns a new |
| public long | |
| public double | |
| public CacheStats | |
| public long | requestCount()
Returns the number of times |
| public String | |
| public long |
| evictionCount | back to summary |
|---|---|
| private final long evictionCount | |
| hitCount | back to summary |
|---|---|
| private final long hitCount | |
| loadExceptionCount | back to summary |
|---|---|
| private final long loadExceptionCount | |
| loadSuccessCount | back to summary |
|---|---|
| private final long loadSuccessCount | |
| missCount | back to summary |
|---|---|
| private final long missCount | |
| totalLoadTime | back to summary |
|---|---|
private final long totalLoadTime
| |
| CacheStats | back to summary |
|---|---|
| public CacheStats(long hitCount, long missCount, long loadSuccessCount, long loadExceptionCount, long totalLoadTime, long evictionCount) Constructs a new Five parameters of the same type in a row is a bad thing, but this class is not constructed by end users and is too fine-grained for a builder.
| |
| averageLoadPenalty | back to summary |
|---|---|
| public double averageLoadPenalty() Returns the average time spent loading new values. This is defined as Note the values of the metrics are undefined in case of overflow (though it is guaranteed not to throw an exception). If you require specific handling, we recommend implementing your own stats collector. | |
| equals | back to summary |
|---|---|
| public boolean equals(Object object) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| evictionCount | back to summary |
|---|---|
| public long evictionCount() Returns the number of times an entry has been evicted. This count does not include manual invalidations. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| hitCount | back to summary |
|---|---|
| public long hitCount() Returns the number of times | |
| hitRate | back to summary |
|---|---|
| public double hitRate() Returns the ratio of cache requests which were hits. This is defined as | |
| loadCount | back to summary |
|---|---|
| public long loadCount() Returns the total number of times that Note the values of the metrics are undefined in case of overflow (though it is guaranteed not to throw an exception). If you require specific handling, we recommend implementing your own stats collector. | |
| loadExceptionCount | back to summary |
|---|---|
| public long loadExceptionCount() Returns the number of times | |
| loadExceptionRate | back to summary |
|---|---|
| public double loadExceptionRate() Returns the ratio of cache loading attempts which threw exceptions. This is defined as Note the values of the metrics are undefined in case of overflow (though it is guaranteed not to throw an exception). If you require specific handling, we recommend implementing your own stats collector. | |
| loadSuccessCount | back to summary |
|---|---|
| public long loadSuccessCount() Returns the number of times | |
| minus | back to summary |
|---|---|
| public CacheStats minus(CacheStats other) Returns a new | |
| missCount | back to summary |
|---|---|
| public long missCount() Returns the number of times | |
| missRate | back to summary |
|---|---|
| public double missRate() Returns the ratio of cache requests which were misses. This is defined as | |
| plus | back to summary |
|---|---|
| public CacheStats plus(CacheStats other) Returns a new Note the values of the metrics are undefined in case of overflow (though it is guaranteed not to throw an exception). If you require specific handling, we recommend implementing your own stats collector.
| |
| requestCount | back to summary |
|---|---|
| public long requestCount() Returns the number of times Note the values of the metrics are undefined in case of overflow (though it is guaranteed not to throw an exception). If you require specific handling, we recommend implementing your own stats collector. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| totalLoadTime | back to summary |
|---|---|
| public long totalLoadTime() Returns the total number of nanoseconds the cache has spent loading new values. This can be
used to calculate the miss penalty. This value is increased every time
| |