K
- The key type of the cacheV
- the value type to be stored on the cachepublic class SerializableCache<K,V>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
cacheFileName |
protected java.util.Map<K,V> |
serializedCache |
Constructor and Description |
---|
SerializableCache(java.lang.String cacheFileName)
set cacheFileName to null to disable caching
|
Modifier and Type | Method and Description |
---|---|
void |
cache(K name,
V data)
This will not cache null values.
|
void |
disableCache() |
void |
enableCache() |
void |
flushCache() |
V |
get(K name) |
boolean |
isCacheEnabled() |
boolean |
isDebug() |
java.util.Map<K,V> |
reloadFromFile() |
void |
setDebug(boolean debug) |
public SerializableCache(java.lang.String cacheFileName)
cacheFileName
- public boolean isCacheEnabled()
public void cache(K name, V data)
name
- data
- public void disableCache()
public void enableCache()
public void flushCache()
public boolean isDebug()
public void setDebug(boolean debug)