Package org.apache.cassandra.cache
Class AutoSavingCache<K extends CacheKey,V>
- java.lang.Object
-
- org.apache.cassandra.cache.InstrumentingCache<K,V>
-
- org.apache.cassandra.cache.AutoSavingCache<K,V>
-
public class AutoSavingCache<K extends CacheKey,V> extends InstrumentingCache<K,V>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAutoSavingCache.CacheSerializer<K extends CacheKey,V>static interfaceAutoSavingCache.IStreamFactoryclassAutoSavingCache.Writer
-
Field Summary
Fields Modifier and Type Field Description protected CacheService.CacheTypecacheTypestatic java.util.Set<CacheService.CacheType>flushInProgressTrue if a cache flush is currently executing: only one may execute at a time.protected java.util.concurrent.ScheduledFuture<?>saveTask
-
Constructor Summary
Constructors Constructor Description AutoSavingCache(ICache<K,V> cache, CacheService.CacheType cacheType, AutoSavingCache.CacheSerializer<K,V> cacheloader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FilegetCacheCrcPath(java.lang.String version)FilegetCacheDataPath(java.lang.String version)AutoSavingCache.WritergetWriter(int keysToSave)intloadSaved()Future<java.lang.Integer>loadSavedAsync()voidscheduleSaving(int savePeriodInSeconds, int keysToSave)static voidsetStreamFactory(AutoSavingCache.IStreamFactory streamFactory)Future<?>submitWrite(int keysToSave)-
Methods inherited from class org.apache.cassandra.cache.InstrumentingCache
clear, containsKey, get, getCapacity, getInternal, getMetrics, hotKeyIterator, keyIterator, put, putIfAbsent, remove, replace, setCapacity, size, weightedSize
-
-
-
-
Field Detail
-
flushInProgress
public static final java.util.Set<CacheService.CacheType> flushInProgress
True if a cache flush is currently executing: only one may execute at a time.
-
saveTask
protected volatile java.util.concurrent.ScheduledFuture<?> saveTask
-
cacheType
protected final CacheService.CacheType cacheType
-
-
Constructor Detail
-
AutoSavingCache
public AutoSavingCache(ICache<K,V> cache, CacheService.CacheType cacheType, AutoSavingCache.CacheSerializer<K,V> cacheloader)
-
-
Method Detail
-
setStreamFactory
public static void setStreamFactory(AutoSavingCache.IStreamFactory streamFactory)
-
getCacheDataPath
public File getCacheDataPath(java.lang.String version)
-
getCacheCrcPath
public File getCacheCrcPath(java.lang.String version)
-
getWriter
public AutoSavingCache.Writer getWriter(int keysToSave)
-
scheduleSaving
public void scheduleSaving(int savePeriodInSeconds, int keysToSave)
-
loadSavedAsync
public Future<java.lang.Integer> loadSavedAsync()
-
loadSaved
public int loadSaved()
-
submitWrite
public Future<?> submitWrite(int keysToSave)
-
-