public enum DisabledStatsCounter extends Enum<DisabledStatsCounter> implements StatsCounter
StatsCounter
implementation that does not record any cache events.Enum Constant and Description |
---|
INSTANCE |
Modifier and Type | Method and Description |
---|---|
static StatsCounter |
get() |
void |
recordEviction()
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.
|
CacheStats |
snapshot()
Returns a snapshot of this counter's values.
|
String |
toString() |
static DisabledStatsCounter |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static DisabledStatsCounter[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DisabledStatsCounter INSTANCE
public static DisabledStatsCounter[] values()
for (DisabledStatsCounter c : DisabledStatsCounter.values()) System.out.println(c);
public static DisabledStatsCounter valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static StatsCounter get()
public void recordHits(int count)
StatsCounter
recordHits
in interface StatsCounter
count
- the number of hits to recordpublic void recordMisses(int count)
StatsCounter
Cache
lookup methods with the same
key on an absent value should result in a single call to either recordLoadSuccess
or
recordLoadFailure
and multiple calls to this method, despite all being served by the
results of a single load operation.recordMisses
in interface StatsCounter
count
- the number of misses to recordpublic void recordLoadSuccess(long loadTime)
StatsCounter
StatsCounter.recordMisses(int)
, this method should only be called by the loading thread.recordLoadSuccess
in interface StatsCounter
loadTime
- the number of nanoseconds the cache spent computing or retrieving the new valuepublic void recordLoadFailure(long loadTime)
StatsCounter
StatsCounter.recordMisses(int)
, this method should only be called by the loading
thread.recordLoadFailure
in interface StatsCounter
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 thrownpublic void recordEviction()
StatsCounter
invalidations
.recordEviction
in interface StatsCounter
public CacheStats snapshot()
StatsCounter
snapshot
in interface StatsCounter
public String toString()
toString
in class Enum<DisabledStatsCounter>