public abstract class AbstractFileSystemCache<K,V> extends Object implements ApplicationCache<K,V>, Serializable
Extends the ApplicationCache contract providing base for using file system as
storage for the cache.
ApplicationCache,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentMap<K,V> |
cache |
| Constructor and Description |
|---|
AbstractFileSystemCache() |
AbstractFileSystemCache(CacheType type) |
AbstractFileSystemCache(CacheType type,
String cacheDir,
String cacheFile) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
destroy() |
void |
flush()
Flushes the application cache (doesn't destroy it).
|
void |
initialize()
Initializes the application cache (doesn't create it).
|
AbstractFileSystemCache<K,V> |
setCacheDir(String cacheDir)
Sets the cache directory location to use with the particular type of cache in focus.
|
AbstractFileSystemCache<K,V> |
setCacheFile(String cacheFile)
Sets the cache filename to use with the particular type of cache in focus.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitevictFromCache, getFromCache, putInCacheprotected final ConcurrentMap<K,V> cache
public AbstractFileSystemCache()
public AbstractFileSystemCache(CacheType type)
public void initialize()
ApplicationCacheInitializes the application cache (doesn't create it). Can make use of a data-store for pre-fetching already stored application data (if required) typically upon container restart.
Each type of application cache is initialized separately in order to maintain sanity and usage simplicity. Thus, please be advised that a cache type must be instantiated & initialized manually before use (manually just means that extra code is required for the same).
initialize in interface ApplicationCache<K,V>public void flush()
ApplicationCacheFlushes the application cache (doesn't destroy it). Note that flushing an application cache doesn't mean it is destroyed. It may just be reduced in size or cleared in order to re-claim memory.
Each type of application cache is flushed separately in order to maintain sanity and usage simplicity. Thus, please be advised that a cache type must be flushed & manually whenever required (manually just means that extra code is required for the same).
flush in interface ApplicationCache<K,V>public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic void destroy()
throws Exception
destroy in interface org.springframework.beans.factory.DisposableBeanExceptionpublic AbstractFileSystemCache<K,V> setCacheDir(String cacheDir)
Sets the cache directory location to use with the particular type of cache in focus.
cacheDir - the cache directory location to useAbstractFileSystemCache for further customizationpublic AbstractFileSystemCache<K,V> setCacheFile(String cacheFile)
Sets the cache filename to use with the particular type of cache in focus.
cacheFile - the cache filename to useAbstractFileSystemCache for further customizationCopyright © 2015. All rights reserved.