Enum Class DisabledStatsCounter
- All Implemented Interfaces:
StatsCounter
,Serializable
,Comparable<DisabledStatsCounter>
,Constable
A
StatsCounter
implementation that does not record any cache events.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Records the eviction of an entry from the cache.void
recordHits
(int count) Records cache hits.void
recordLoadFailure
(long loadTime) Records the failed load of a new entry.void
recordLoadSuccess
(long loadTime) Records the successful load of a new entry.void
recordMisses
(int count) Records cache misses.snapshot()
Returns a snapshot of this counter's values.toString()
static DisabledStatsCounter
Returns the enum constant of this class with the specified name.static DisabledStatsCounter[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
Methods inherited from interface com.github.benmanes.caffeine.cache.stats.StatsCounter
recordEviction
-
Enum Constant Details
-
INSTANCE
-
-
Constructor Details
-
DisabledStatsCounter
private DisabledStatsCounter()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
recordHits
public void recordHits(int count) Description copied from interface:StatsCounter
Records cache hits. This should be called when a cache request returns a cached value.- Specified by:
recordHits
in interfaceStatsCounter
- Parameters:
count
- the number of hits to record
-
recordMisses
public void recordMisses(int count) Description copied from interface:StatsCounter
Records cache misses. This should be called when a cache request returns a value that was not found in the cache. This method should be called by the loading thread, as well as by threads blocking on the load. Multiple concurrent calls toCache
lookup methods with the same key on an absent value should result in a single call to eitherrecordLoadSuccess
orrecordLoadFailure
and multiple calls to this method, despite all being served by the results of a single load operation.- Specified by:
recordMisses
in interfaceStatsCounter
- Parameters:
count
- the number of misses to record
-
recordLoadSuccess
public void recordLoadSuccess(long loadTime) Description copied from interface:StatsCounter
Records the successful load of a new entry. This should be called when a cache request causes an entry to be loaded, and the loading completes successfully. In contrast toStatsCounter.recordMisses(int)
, this method should only be called by the loading thread.- Specified by:
recordLoadSuccess
in interfaceStatsCounter
- Parameters:
loadTime
- the number of nanoseconds the cache spent computing or retrieving the new value
-
recordLoadFailure
public void recordLoadFailure(long loadTime) Description copied from interface:StatsCounter
Records the failed load of a new entry. This should be called when a cache request causes an entry to be loaded, but either no value is found or an exception is thrown while loading the entry. In contrast toStatsCounter.recordMisses(int)
, this method should only be called by the loading thread.- Specified by:
recordLoadFailure
in interfaceStatsCounter
- Parameters:
loadTime
- the number of nanoseconds the cache spent computing or retrieving the new value prior to discovering the value doesn't exist or an exception being thrown
-
recordEviction
public void recordEviction()Description copied from interface:StatsCounter
Records the eviction of an entry from the cache. This should only been called when an entry is evicted due to the cache's eviction strategy, and not as a result of manualinvalidations
.- Specified by:
recordEviction
in interfaceStatsCounter
-
snapshot
Description copied from interface:StatsCounter
Returns a snapshot of this counter's values. Note that this may be an inconsistent view, as it may be interleaved with update operations.- Specified by:
snapshot
in interfaceStatsCounter
- Returns:
- a snapshot of this counter's values
-
toString
- Overrides:
toString
in classEnum<DisabledStatsCounter>
-