public class AutoSavingCache<K extends CacheKey,V> extends InstrumentingCache<K,V>
Modifier and Type | Class and Description |
---|---|
static interface |
AutoSavingCache.CacheSerializer<K extends CacheKey,V> |
static interface |
AutoSavingCache.IStreamFactory |
class |
AutoSavingCache.Writer |
Modifier and Type | Field and Description |
---|---|
protected CacheService.CacheType |
cacheType |
static java.util.Set<CacheService.CacheType> |
flushInProgress
True if a cache flush is currently executing: only one may execute at a time.
|
protected java.util.concurrent.ScheduledFuture<?> |
saveTask |
Constructor and Description |
---|
AutoSavingCache(ICache<K,V> cache,
CacheService.CacheType cacheType,
AutoSavingCache.CacheSerializer<K,V> cacheloader) |
Modifier and Type | Method and Description |
---|---|
java.io.File |
getCacheCrcPath(java.lang.String version) |
java.io.File |
getCacheDataPath(java.lang.String version) |
AutoSavingCache.Writer |
getWriter(int keysToSave) |
int |
loadSaved() |
com.google.common.util.concurrent.ListenableFuture<java.lang.Integer> |
loadSavedAsync() |
void |
scheduleSaving(int savePeriodInSeconds,
int keysToSave) |
static void |
setStreamFactory(AutoSavingCache.IStreamFactory streamFactory) |
java.util.concurrent.Future<?> |
submitWrite(int keysToSave) |
clear, containsKey, get, getCapacity, getInternal, getMetrics, hotKeyIterator, keyIterator, put, putIfAbsent, remove, replace, setCapacity, size, weightedSize
public static final java.util.Set<CacheService.CacheType> flushInProgress
protected volatile java.util.concurrent.ScheduledFuture<?> saveTask
protected final CacheService.CacheType cacheType
public AutoSavingCache(ICache<K,V> cache, CacheService.CacheType cacheType, AutoSavingCache.CacheSerializer<K,V> cacheloader)
public static void setStreamFactory(AutoSavingCache.IStreamFactory streamFactory)
public java.io.File getCacheDataPath(java.lang.String version)
public java.io.File getCacheCrcPath(java.lang.String version)
public AutoSavingCache.Writer getWriter(int keysToSave)
public void scheduleSaving(int savePeriodInSeconds, int keysToSave)
public com.google.common.util.concurrent.ListenableFuture<java.lang.Integer> loadSavedAsync()
public int loadSaved()
public java.util.concurrent.Future<?> submitWrite(int keysToSave)
Copyright © 2009-2021 The Apache Software Foundation