public class ObjectCache
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map |
cache
The expression caches for filename.
|
protected java.lang.String |
filename
The filename of the cache.
|
protected boolean |
persist_always
The persist strategy (always or only on demand by manually calling persist).
|
protected boolean |
persist_single
The flag indicating if cached objects are stored on disk themselves.
|
| Constructor and Description |
|---|
ObjectCache(java.lang.String filename)
Create a new cache.
|
ObjectCache(java.lang.String filename,
boolean persist_always,
boolean persist_single)
Create a new cache.
|
ObjectCache(java.lang.String filename,
boolean persist_always,
boolean persist_single,
int max)
Create a new cache.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(CachedObject co)
Add a cached object.
|
void |
clear()
Clear the cache.
|
CachedObject |
loadCachedObject(java.lang.String filename,
long lastmodified)
Load the cached file.
|
static ObjectCache |
loadObjectCache(java.lang.String filename)
Load the model cache.
|
void |
persist()
Presist the cached object.
|
void |
remove(java.lang.String filename)
Add a cached object.
|
protected boolean persist_always
protected boolean persist_single
protected java.lang.String filename
protected java.util.Map cache
public ObjectCache(java.lang.String filename)
public ObjectCache(java.lang.String filename,
boolean persist_always,
boolean persist_single)
public ObjectCache(java.lang.String filename,
boolean persist_always,
boolean persist_single,
int max)
public CachedObject loadCachedObject(java.lang.String filename, long lastmodified)
filename - The filename of the cached object.lastmodified - The last modified date important for the up-to-date check.
-1 for do not check.public void add(CachedObject co)
co - The new object.public void remove(java.lang.String filename)
filename - The filename.public void persist()
throws java.io.IOException
java.io.IOExceptionpublic void clear()
public static ObjectCache loadObjectCache(java.lang.String filename)
filename - The filename.