public abstract class AbstractFileSystemCache<V> extends Object implements ApplicationCache<Key,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<Key,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).
|
protected Key |
generate(Object identifier) |
void |
initialize()
Initializes the application cache (doesn't create it).
|
AbstractFileSystemCache<V> |
setCacheDir(String cacheDir)
Sets the cache directory location to use with the particular type of cache in focus.
|
AbstractFileSystemCache<V> |
setCacheFile(String cacheFile)
Sets the cache filename to use with the particular type of cache in focus.
|
AbstractFileSystemCache<V> |
setTtl(Long ttl)
Sets the time-to-live for an entry in cache.
|
AbstractFileSystemCache<V> |
setTtlUnit(TimeUnit ttlUnit)
Sets the time unit for cache entry time-to-live strategy.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitevictFromCache, getFromCache, putInCacheprotected final ConcurrentMap<Key,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<Key,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<Key,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<V> setTtl(Long ttl)
Sets the time-to-live for an entry in cache.
ttl - the ttl to setAbstractFileSystemCache for further customizationpublic AbstractFileSystemCache<V> setTtlUnit(TimeUnit ttlUnit)
Sets the time unit for cache entry time-to-live strategy.
ttlUnit - the ttl time unit to setAbstractFileSystemCache for further customizationpublic AbstractFileSystemCache<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<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.