Package jadex.collection
Class ObjectCache
java.lang.Object
jadex.collection.ObjectCache
- All Implemented Interfaces:
Serializable
A cache for CachedObjects that reflect files.
A cached object is loaded per filename
(not the filename of the held object in the cache).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map
<String, CachedObject> The expression caches for filename.protected String
The filename of the cache.protected boolean
The persist strategy (always or only on demand by manually calling persist).protected boolean
The flag indicating if cached objects are stored on disk themselves. -
Constructor Summary
ConstructorsConstructorDescriptionObjectCache
(String filename) Create a new cache.ObjectCache
(String filename, boolean persist_always, boolean persist_single) Create a new cache.ObjectCache
(String filename, boolean persist_always, boolean persist_single, int max) Create a new cache. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(CachedObject co) Add a cached object.void
clear()
Clear the cache.loadCachedObject
(String filename, long lastmodified) Load the cached file.static ObjectCache
loadObjectCache
(String filename) Load the model cache.void
persist()
Presist the cached object.void
Add a cached object.
-
Field Details
-
persist_always
protected boolean persist_alwaysThe persist strategy (always or only on demand by manually calling persist). -
persist_single
protected boolean persist_singleThe flag indicating if cached objects are stored on disk themselves. -
filename
The filename of the cache. -
cache
The expression caches for filename.
-
-
Constructor Details
-
ObjectCache
Create a new cache. -
ObjectCache
Create a new cache. -
ObjectCache
Create a new cache.
-
-
Method Details
-
loadCachedObject
Load the cached file.- Parameters:
filename
- The filename of the cached object.lastmodified
- The last modified date important for the up-to-date check. -1 for do not check.
-
add
Add a cached object.- Parameters:
co
- The new object.
-
remove
Add a cached object.- Parameters:
filename
- The filename.
-
persist
Presist the cached object.- Throws:
IOException
-
clear
public void clear()Clear the cache. -
loadObjectCache
Load the model cache.- Parameters:
filename
- The filename.- Returns:
- The object cache.
-