org.apache.ignite.cache

## Interface CacheMetrics

All Known Subinterfaces:
  CacheMetricsMXBean

All Known Implementing Classes:
  CacheMetricsImpl, CacheMetricsSnapshot

    public interface CacheMetrics

Cache metrics used to obtain statistics on cache itself. Use `IgniteCache.metrics()` to obtain metrics for a cache.

### Method Summary

Methods
`float` `getAverageGetTime()` The mean time to execute gets.
`float` `getAveragePutTime()` The mean time to execute puts.
`float` `getAverageRemoveTime()` The mean time to execute removes.
`float` `getAverageTxCommitTime()` The mean time to execute tx commit.
`float` `getAverageTxRollbackTime()` The mean time to execute tx rollbacks.
`long` `getCacheEvictions()` The total number of evictions from the cache.
`long` `getCacheGets()` The total number of requests to the cache.
`float` `getCacheHitPercentage()` This is a measure of cache efficiency.
`long` `getCacheHits()` The number of get requests that were satisfied by the cache.
`long` `getCacheMisses()` A miss is a get request that is not satisfied.
`float` `getCacheMissPercentage()` Returns the percentage of cache accesses that did not find a requested entry in the cache.
`long` `getCachePuts()` The total number of puts to the cache.
`long` `getCacheRemovals()` The total number of removals from the cache.
`long` `getCacheTxCommits()` Gets total number of transaction commits.
`long` `getCacheTxRollbacks()` Gets total number of transaction rollbacks.
`int` `getDhtEvictQueueCurrentSize()` Gets current size of evict queue used to batch up evictions.
`int` `getKeySize()` Gets number of keys in the cache, possibly with `null` values.
`String` `getKeyType()` Determines the required type of keys for this `Cache`, if any.
`long` `getOffHeapAllocatedSize()` Gets memory size allocated in off-heap.
`long` `getOffHeapBackupEntriesCount()` Gets number of backup entries stored in off-heap memory.
`long` `getOffHeapEntriesCount()` Gets number of entries stored in off-heap memory.
`long` `getOffHeapEvictions()` The total number of evictions from the off-heap memory.
`long` `getOffHeapGets()` The total number of get requests to the off-heap memory.
`float` `getOffHeapHitPercentage()` Gets the percentage of hits on off-heap memory.
`long` `getOffHeapHits()` The number of get requests that were satisfied by the off-heap memory.
`long` `getOffHeapMisses()` A miss is a get request that is not satisfied by off-heap memory.
`float` `getOffHeapMissPercentage()` Gets the percentage of misses on off-heap memory.
`long` `getOffHeapPrimaryEntriesCount()` Gets number of primary entries stored in off-heap memory.
`long` `getOffHeapPuts()` The total number of put requests to the off-heap memory.
`long` `getOffHeapRemovals()` The total number of removals from the off-heap memory.
`int` `getSize()` Gets number of non-`null` values in the cache.
`int` `getTxCommitQueueSize()` Gets committed transaction queue size.
`int` `getTxCommittedVersionsSize()` Gets number of cached committed transaction IDs.
`int` `getTxDhtCommitQueueSize()` Gets committed DHT transaction queue size.
`int` `getTxDhtCommittedVersionsSize()` Gets number of cached committed DHT transaction IDs.
`int` `getTxDhtPrepareQueueSize()` Gets prepared DHT transaction queue size.
`int` `getTxDhtRolledbackVersionsSize()` Gets number of cached rolled back DHT transaction IDs.
`int` `getTxDhtStartVersionCountsSize()` Gets DHT start version counts map size.
`int` `getTxDhtThreadMapSize()` Gets transaction DHT per-thread map size.
`int` `getTxDhtXidMapSize()` Gets transaction DHT per-Xid map size.
`int` `getTxPrepareQueueSize()` Gets prepared transaction queue size.
`int` `getTxRolledbackVersionsSize()` Gets number of cached rolled back transaction IDs.
`int` `getTxStartVersionCountsSize()` Gets start version counts map size.
`int` `getTxThreadMapSize()` Gets transaction per-thread map size.
`int` `getTxXidMapSize()` Gets transaction per-Xid map size.
`String` `getValueType()` Determines the required type of values for this `Cache`, if any.
`int` `getWriteBehindBufferSize()` Gets count of entries that were processed by the write-behind store and have not been flushed to the underlying store yet.
`int` `getWriteBehindCriticalOverflowCount()` Gets count of write buffer overflow events in progress at the moment.
`int` `getWriteBehindErrorRetryCount()` Gets count of cache entries that are in a store-retry state.
`long` `getWriteBehindFlushFrequency()` Gets the cache flush frequency.
`int` `getWriteBehindFlushSize()` Gets the maximum size of the write-behind buffer.
`int` `getWriteBehindFlushThreadCount()` Gets the number of flush threads that will perform store update operations.
`int` `getWriteBehindStoreBatchSize()` Gets the maximum count of similar (put or remove) operations that can be grouped to a single batch.
`int` `getWriteBehindTotalCriticalOverflowCount()` Gets count of write buffer overflow events since initialization.
`boolean` `isEmpty()` Returns `true` if this cache is empty.
`boolean` `isManagementEnabled()` Checks whether management is enabled on this cache.
`boolean` `isReadThrough()` Determines if a `Cache` should operate in read-through mode.
`boolean` `isStatisticsEnabled()` Checks whether statistics collection is enabled in this cache.
`boolean` `isStoreByValue()` Whether storeByValue `true` or storeByReference `false`.
`boolean` `isWriteBehindEnabled()` Returns `true` if write-behind is enabled.
`boolean` `isWriteThrough()` Determines if a `Cache` should operate in "write-through" mode.
`String` `name()` Gets name of this cache.

### Method Detail

#### getCacheHits

    long getCacheHits()

The number of get requests that were satisfied by the cache.

Returns:
  The number of hits.

#### getCacheHitPercentage

    float getCacheHitPercentage()

This is a measure of cache efficiency.

Returns:
  The percentage of successful hits, as a decimal e.g 75.

#### getCacheMisses

    long getCacheMisses()

A miss is a get request that is not satisfied.

Returns:
  The number of misses.

#### getCacheMissPercentage

    float getCacheMissPercentage()

Returns the percentage of cache accesses that did not find a requested entry in the cache.

Returns:
  The percentage of accesses that failed to find anything.

#### getCacheGets

    long getCacheGets()

The total number of requests to the cache. This will be equal to the sum of the hits and misses.

Returns:
  The number of gets.

#### getCachePuts

    long getCachePuts()

The total number of puts to the cache.

Returns:
  The number of puts.

#### getCacheRemovals

    long getCacheRemovals()

The total number of removals from the cache. This does not include evictions, where the cache itself initiates the removal to make space.

Returns:
  The number of removals.

#### getCacheEvictions

    long getCacheEvictions()

The total number of evictions from the cache. An eviction is a removal initiated by the cache itself to free up space. An eviction is not treated as a removal and does not appear in the removal counts.

Returns:
  The number of evictions.

#### getAverageGetTime

    float getAverageGetTime()

The mean time to execute gets.

Returns:
  The time in µs.

#### getAveragePutTime

    float getAveragePutTime()

The mean time to execute puts.

Returns:
  The time in µs.

#### getAverageRemoveTime

    float getAverageRemoveTime()

The mean time to execute removes.

Returns:
  The time in µs.

#### getAverageTxCommitTime

    float getAverageTxCommitTime()

The mean time to execute tx commit.

Returns:
  The time in µs.

#### getAverageTxRollbackTime

    float getAverageTxRollbackTime()

The mean time to execute tx rollbacks.

Returns:
  Number of transaction rollbacks.

#### getCacheTxCommits

    long getCacheTxCommits()

Gets total number of transaction commits.

Returns:
  Number of transaction commits.

#### getCacheTxRollbacks

    long getCacheTxRollbacks()

Gets total number of transaction rollbacks.

Returns:
  Number of transaction rollbacks.

#### name

    String name()

Gets name of this cache.

Returns:
  Cache name.

#### getOffHeapGets

    long getOffHeapGets()

The total number of get requests to the off-heap memory.

Returns:
  The number of gets.

#### getOffHeapPuts

    long getOffHeapPuts()

The total number of put requests to the off-heap memory.

Returns:
  The number of puts.

#### getOffHeapRemovals

    long getOffHeapRemovals()

The total number of removals from the off-heap memory. This does not include evictions.

Returns:
  The number of removals.

#### getOffHeapEvictions

    long getOffHeapEvictions()

The total number of evictions from the off-heap memory.

Returns:
  The number of evictions.

#### getOffHeapHits

    long getOffHeapHits()

The number of get requests that were satisfied by the off-heap memory.

Returns:
  The off-heap hits number.

#### getOffHeapHitPercentage

    float getOffHeapHitPercentage()

Gets the percentage of hits on off-heap memory.

Returns:
  The percentage of hits on off-heap memory.

#### getOffHeapMisses

    long getOffHeapMisses()

A miss is a get request that is not satisfied by off-heap memory.

Returns:
  The off-heap misses number.

#### getOffHeapMissPercentage

    float getOffHeapMissPercentage()

Gets the percentage of misses on off-heap memory.

Returns:
  The percentage of misses on off-heap memory.

#### getOffHeapEntriesCount

    long getOffHeapEntriesCount()

Gets number of entries stored in off-heap memory.

Returns:
  Number of entries stored in off-heap memory.

#### getOffHeapPrimaryEntriesCount

    long getOffHeapPrimaryEntriesCount()

Gets number of primary entries stored in off-heap memory.

Returns:
  Number of primary entries stored in off-heap memory.

#### getOffHeapBackupEntriesCount

    long getOffHeapBackupEntriesCount()

Gets number of backup entries stored in off-heap memory.

Returns:
  Number of backup entries stored in off-heap memory.

#### getOffHeapAllocatedSize

    long getOffHeapAllocatedSize()

Gets memory size allocated in off-heap.

Returns:
  Memory size allocated in off-heap.

#### getSize

    int getSize()

Gets number of non-`null` values in the cache.

Returns:
  Number of non-`null` values in the cache.

#### getKeySize

    int getKeySize()

Gets number of keys in the cache, possibly with `null` values.

Returns:
  Number of keys in the cache.

#### isEmpty

    boolean isEmpty()

Returns `true` if this cache is empty.

Returns:
  `True` if this cache is empty.

#### getDhtEvictQueueCurrentSize

    int getDhtEvictQueueCurrentSize()

Gets current size of evict queue used to batch up evictions.

Returns:
  Current size of evict queue.

#### getTxThreadMapSize

    int getTxThreadMapSize()

Gets transaction per-thread map size.

Returns:
  Thread map size.

#### getTxXidMapSize

    int getTxXidMapSize()

Gets transaction per-Xid map size.

Returns:
  Transaction per-Xid map size.

#### getTxCommitQueueSize

    int getTxCommitQueueSize()

Gets committed transaction queue size.

Returns:
  Committed transaction queue size.

#### getTxPrepareQueueSize

    int getTxPrepareQueueSize()

Gets prepared transaction queue size.

Returns:
  Prepared transaction queue size.

#### getTxStartVersionCountsSize

    int getTxStartVersionCountsSize()

Gets start version counts map size.

Returns:
  Start version counts map size.

#### getTxCommittedVersionsSize

    int getTxCommittedVersionsSize()

Gets number of cached committed transaction IDs.

Returns:
  Number of cached committed transaction IDs.

#### getTxRolledbackVersionsSize

    int getTxRolledbackVersionsSize()

Gets number of cached rolled back transaction IDs.

Returns:
  Number of cached rolled back transaction IDs.

#### getTxDhtThreadMapSize

    int getTxDhtThreadMapSize()

Gets transaction DHT per-thread map size.

Returns:
  DHT thread map size.

#### getTxDhtXidMapSize

    int getTxDhtXidMapSize()

Gets transaction DHT per-Xid map size.

Returns:
  Transaction DHT per-Xid map size.

#### getTxDhtCommitQueueSize

    int getTxDhtCommitQueueSize()

Gets committed DHT transaction queue size.

Returns:
  Committed DHT transaction queue size.

#### getTxDhtPrepareQueueSize

    int getTxDhtPrepareQueueSize()

Gets prepared DHT transaction queue size.

Returns:
  Prepared DHT transaction queue size.

#### getTxDhtStartVersionCountsSize

    int getTxDhtStartVersionCountsSize()

Gets DHT start version counts map size.

Returns:
  DHT start version counts map size.

#### getTxDhtCommittedVersionsSize

    int getTxDhtCommittedVersionsSize()

Gets number of cached committed DHT transaction IDs.

Returns:
  Number of cached committed DHT transaction IDs.

#### getTxDhtRolledbackVersionsSize

    int getTxDhtRolledbackVersionsSize()

Gets number of cached rolled back DHT transaction IDs.

Returns:
  Number of cached rolled back DHT transaction IDs.

#### isWriteBehindEnabled

    boolean isWriteBehindEnabled()

Returns `true` if write-behind is enabled.

Returns:
  `True` if write-behind is enabled.

#### getWriteBehindFlushSize

    int getWriteBehindFlushSize()

Gets the maximum size of the write-behind buffer. When the count of unique keys in write buffer exceeds this value, the buffer is scheduled for write to the underlying store.

If this value is `0`, then flush is performed only on time-elapsing basis. However, when this value is `0`, the cache critical size is set to `CacheConfiguration.DFLT_WRITE_BEHIND_CRITICAL_SIZE`

Returns:
  Buffer size that triggers flush procedure.

#### getWriteBehindFlushThreadCount

    int getWriteBehindFlushThreadCount()

Gets the number of flush threads that will perform store update operations.

Returns:
  Count of worker threads.

#### getWriteBehindFlushFrequency

    long getWriteBehindFlushFrequency()

Gets the cache flush frequency. All pending operations on the underlying store will be performed within time interval not less then this value.

If this value is `0`, then flush is performed only when buffer size exceeds flush size.

Returns:
  Flush frequency in milliseconds.

#### getWriteBehindStoreBatchSize

    int getWriteBehindStoreBatchSize()

Gets the maximum count of similar (put or remove) operations that can be grouped to a single batch.

Returns:
  Maximum size of batch.

#### getWriteBehindTotalCriticalOverflowCount

    int getWriteBehindTotalCriticalOverflowCount()

Gets count of write buffer overflow events since initialization. Each overflow event causes the ongoing flush operation to be performed synchronously.

Returns:
  Count of cache overflow events since start.

#### getWriteBehindCriticalOverflowCount

    int getWriteBehindCriticalOverflowCount()

Gets count of write buffer overflow events in progress at the moment. Each overflow event causes the ongoing flush operation to be performed synchronously.

Returns:
  Count of cache overflow events since start.

#### getWriteBehindErrorRetryCount

    int getWriteBehindErrorRetryCount()

Gets count of cache entries that are in a store-retry state. An entry is assigned a store-retry state when underlying store failed due some reason and cache has enough space to retain this entry till the next try.

Returns:
  Count of entries in store-retry state.

#### getWriteBehindBufferSize

    int getWriteBehindBufferSize()

Gets count of entries that were processed by the write-behind store and have not been flushed to the underlying store yet.

Returns:
  Total count of entries in cache store internal buffer.

#### getKeyType

    String getKeyType()

Determines the required type of keys for this `Cache`, if any.

Returns:
  The fully qualified class name of the key type, or `"java.lang.Object"` if the type is undefined.

#### getValueType

    String getValueType()

Determines the required type of values for this `Cache`, if any.

Returns:
  The fully qualified class name of the value type, or `"java.lang.Object"` if the type is undefined.

#### isStoreByValue

    boolean isStoreByValue()

Whether storeByValue `true` or storeByReference `false`. When `true`, both keys and values are stored by value.

When `false`, both keys and values are stored by reference. Caches stored by reference are capable of mutation by any threads holding the reference. The effects are:

- if the key is mutated, then the key may not be retrievable or removable
- if the value is mutated, then all threads in the JVM can potentially observe those mutations, subject to the normal Java Memory Model rules.

Storage by reference only applies to the local heap. If an entry is moved off heap it will need to be transformed into a representation. Any mutations that occur after transformation may not be reflected in the cache.

When a cache is storeByValue, any mutation to the key or value does not affect the key of value stored in the cache.

The default value is `true`.

Returns:
  `True` if the cache is store by value.

#### isStatisticsEnabled

    boolean isStatisticsEnabled()

Checks whether statistics collection is enabled in this cache.

The default value is `false`.

Returns:
  `True` if statistics collection is enabled.

#### isManagementEnabled

    boolean isManagementEnabled()

Checks whether management is enabled on this cache.

The default value is `false`.

Returns:
  `true` if management is enabled.

#### isReadThrough

    boolean isReadThrough()

Determines if a `Cache` should operate in read-through mode.

The default value is `false`

Returns:
  `True` when a `Cache` is in "read-through" mode.
See Also:
  `CacheLoader`

#### isWriteThrough

    boolean isWriteThrough()

Determines if a `Cache` should operate in "write-through" mode.

will appropriately cause the configured `CacheWriter` to be invoked.

The default value is `false`

Returns:
  `True` when a `Cache` is in "write-through" mode.
See Also:
  `CacheWriter`

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.0.0
Release Date | : April 30 2017