com.atlassian.cache
Enum CacheStatisticsKey

java.lang.Object
  extended by java.lang.Enum<CacheStatisticsKey>
      extended by com.atlassian.cache.CacheStatisticsKey
All Implemented Interfaces:
Serializable, Comparable<CacheStatisticsKey>

public enum CacheStatisticsKey
extends Enum<CacheStatisticsKey>

An immutable representation of a statistics key for a Cache. This class is used by ManagedCache.getStatistics() to dynamically distinguish different cache statistics available for a Cache.

Since:
v2.4.0

Enum Constant Summary
EVICTION_COUNT
          Returns the number of times an entry has been evicted.
HEAP_SIZE
          Returns the number of bytes used by the Cache.
HIT_COUNT
          Returns the number of times Cache lookup methods have returned a cached value.
MISS_COUNT
          Returns the number of times Cache lookup methods have returned an uncached (newly loaded) value, or null.
PUT_COUNT
          Returns the number of times Cache put methods have added a cached value.
REMOVE_COUNT
          Returns the number of times Cache remove methods have removed a cached value.
SIZE
          Returns the number of cached objects kept referenced by the Cache (depends on the cache implementation)
TOTAL_MISS_TIME
          Returns the number of nanoseconds spent computing values for cache misses.
 
Field Summary
static Comparator<CacheStatisticsKey> SORT_BY_LABEL
          Sorts cache statistics keys by label.
 
Method Summary
 String getLabel()
          Returns the label for this cache statistics key.
 StatisticsType getType()
          Returns the type of statistic that this is.
static CacheStatisticsKey valueOf(String name)
          Returns the enum constant of this type with the specified name.
static CacheStatisticsKey[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

SIZE

public static final CacheStatisticsKey SIZE
Returns the number of cached objects kept referenced by the Cache (depends on the cache implementation)


HEAP_SIZE

public static final CacheStatisticsKey HEAP_SIZE
Returns the number of bytes used by the Cache.

Note: This is likely to be a very expensive statistic in some implementations, so consumers may want to discard it when it hasn't been explicitly requested. Even where available, the reported heap size is almost certain to be only an approximation of the cache's total memory use.


HIT_COUNT

public static final CacheStatisticsKey HIT_COUNT
Returns the number of times Cache lookup methods have returned a cached value.


PUT_COUNT

public static final CacheStatisticsKey PUT_COUNT
Returns the number of times Cache put methods have added a cached value.


REMOVE_COUNT

public static final CacheStatisticsKey REMOVE_COUNT
Returns the number of times Cache remove methods have removed a cached value.


MISS_COUNT

public static final CacheStatisticsKey MISS_COUNT
Returns the number of times Cache lookup methods have returned an uncached (newly loaded) value, or null. Multiple concurrent calls to Cache lookup methods on an absent value can result in multiple misses, all returning the results of a single cache load operation.


TOTAL_MISS_TIME

public static final CacheStatisticsKey TOTAL_MISS_TIME
Returns the number of nanoseconds spent computing values for cache misses. This is only relevant for caches using a CacheLoader.


EVICTION_COUNT

public static final CacheStatisticsKey EVICTION_COUNT
Returns the number of times an entry has been evicted.

Field Detail

SORT_BY_LABEL

public static Comparator<CacheStatisticsKey> SORT_BY_LABEL
Sorts cache statistics keys by label.

Method Detail

values

public static CacheStatisticsKey[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (CacheStatisticsKey c : CacheStatisticsKey.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static CacheStatisticsKey valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
NullPointerException - if the argument is null

getLabel

@Nonnull
public String getLabel()
Returns the label for this cache statistics key. This is intended to be the same as the Enum.name(), except written in camelCase.

Returns:
the label for this cache statistics key.

getType

@Nonnull
public StatisticsType getType()
Returns the type of statistic that this is. Different types of statistics might render differently in a user interface.

Returns:
the type of statistic that this is.


Copyright © 2015 Atlassian. All rights reserved.