## org.apache.cassandra.cache
Class AutoSavingCache<K,V>

    java.lang.Object
      org.apache.cassandra.cache.InstrumentingCache<K,V>
          org.apache.cassandra.cache.AutoSavingCache<K,V>

All Implemented Interfaces:
  InstrumentingCacheMBean

Direct Known Subclasses:
  AutoSavingKeyCache, AutoSavingRowCache

    public abstract class AutoSavingCache<K,V>

extends InstrumentingCache<K,V>

Nested Class Summary
`class` `AutoSavingCache.Writer`

Field Summary
`protected ColumnFamilyStore.CacheType` `cacheType`
`protected java.lang.String` `cfName`
`static java.util.concurrent.atomic.AtomicBoolean` `flushInProgress` True if a cache flush is currently executing: only one may execute at a time.
`protected java.util.concurrent.ScheduledFuture<?>` `saveTask`
`protected java.lang.String` `tableName`

Constructor Summary
`AutoSavingCache(ICache<K,V> cache, java.lang.String tableName, java.lang.String cfName, ColumnFamilyStore.CacheType cacheType)`

Method Summary
`int` `getAdjustedCacheSize(long expectedKeys)`
`java.io.File` `getCachePath()`
`abstract double` `getConfiguredCacheSize(CFMetaData cfm)`
`AutoSavingCache.Writer` `getWriter(int keysToSave)`
`java.util.Set<DecoratedKey>` `readSaved()`
`void` `reduceCacheSize()`
`void` `scheduleSaving(int savePeriodInSeconds, int keysToSave)`
`java.util.concurrent.Future<?>` `submitWrite(int keysToSave)`
`abstract java.nio.ByteBuffer` `translateKey(K key)`
`void` `updateCacheSize(long keys)` Resizes the cache based on a key estimate.

Methods inherited from class org.apache.cassandra.cache.InstrumentingCache
`clear, get, getCapacity, getHits, getInternal, getKeySet, getRecentHitRate, getRequests, getSize, hotKeySet, isCapacitySetManually, isPutCopying, put, remove, setCapacity, size, updateCapacity`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### flushInProgress

    public static final java.util.concurrent.atomic.AtomicBoolean flushInProgress

  True if a cache flush is currently executing: only one may execute at a time.

### cfName

    protected final java.lang.String cfName

### tableName

    protected final java.lang.String tableName

### saveTask

    protected volatile java.util.concurrent.ScheduledFuture<?> saveTask

### cacheType

    protected final ColumnFamilyStore.CacheType cacheType

Constructor Detail

### AutoSavingCache

    public AutoSavingCache(ICache<K,V> cache,
                           java.lang.String tableName,
                           java.lang.String cfName,
                           ColumnFamilyStore.CacheType cacheType)

Method Detail

### translateKey

    public abstract java.nio.ByteBuffer translateKey(K key)

### getConfiguredCacheSize

    public abstract double getConfiguredCacheSize(CFMetaData cfm)

### getAdjustedCacheSize

    public int getAdjustedCacheSize(long expectedKeys)

### getCachePath

    public java.io.File getCachePath()

### getWriter

    public AutoSavingCache.Writer getWriter(int keysToSave)

### scheduleSaving

    public void scheduleSaving(int savePeriodInSeconds,
                               int keysToSave)

### submitWrite

    public java.util.concurrent.Future<?> submitWrite(int keysToSave)

### readSaved

    public java.util.Set<DecoratedKey> readSaved()

### updateCacheSize

    public void updateCacheSize(long keys)

  Resizes the cache based on a key estimate. Caller is in charge of synchronizing this correctly if needed

### reduceCacheSize

    public void reduceCacheSize()

Copyright © 2012 The Apache Software Foundation