org.apache.cassandra.cache
Class InstrumentingCache<K,V>

java.lang.Object
  extended by org.apache.cassandra.cache.InstrumentingCache<K,V>
All Implemented Interfaces:
InstrumentingCacheMBean
Direct Known Subclasses:
AutoSavingCache

public class InstrumentingCache<K,V>
extends java.lang.Object
implements InstrumentingCacheMBean

Wraps an ICache in requests + hits tracking.


Constructor Summary
InstrumentingCache(ICache<K,V> map, java.lang.String table, java.lang.String name)
           
 
Method Summary
 void clear()
           
 V get(K key)
           
 int getCapacity()
           
 long getHits()
          total cache hit count since cache creation
 V getInternal(K key)
           
 java.util.Set<K> getKeySet()
           
 double getRecentHitRate()
          hits / requests since the last time getHitRate was called.
 long getRequests()
          total request count since cache creation
 int getSize()
           
 java.util.Set<K> hotKeySet(int n)
           
 boolean isCapacitySetManually()
           
 boolean isPutCopying()
           
 void put(K key, V value)
           
 void remove(K key)
           
 void setCapacity(int capacity)
           
 int size()
           
 void updateCapacity(int capacity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstrumentingCache

public InstrumentingCache(ICache<K,V> map,
                          java.lang.String table,
                          java.lang.String name)
Method Detail

put

public void put(K key,
                V value)

get

public V get(K key)

getInternal

public V getInternal(K key)

remove

public void remove(K key)

getCapacity

public int getCapacity()
Specified by:
getCapacity in interface InstrumentingCacheMBean

isCapacitySetManually

public boolean isCapacitySetManually()

updateCapacity

public void updateCapacity(int capacity)

setCapacity

public void setCapacity(int capacity)
Specified by:
setCapacity in interface InstrumentingCacheMBean

size

public int size()

getSize

public int getSize()
Specified by:
getSize in interface InstrumentingCacheMBean

getHits

public long getHits()
Description copied from interface: InstrumentingCacheMBean
total cache hit count since cache creation

Specified by:
getHits in interface InstrumentingCacheMBean

getRequests

public long getRequests()
Description copied from interface: InstrumentingCacheMBean
total request count since cache creation

Specified by:
getRequests in interface InstrumentingCacheMBean

getRecentHitRate

public double getRecentHitRate()
Description copied from interface: InstrumentingCacheMBean
hits / requests since the last time getHitRate was called. serious telemetry apps should not use this, and should instead track the deltas from getHits / getRequests themselves, since those will not be affected by multiple users calling it. Provided for convenience only.

Specified by:
getRecentHitRate in interface InstrumentingCacheMBean

clear

public void clear()

getKeySet

public java.util.Set<K> getKeySet()

hotKeySet

public java.util.Set<K> hotKeySet(int n)

isPutCopying

public boolean isPutCopying()


Copyright © 2012 The Apache Software Foundation