Class ObjectCache

java.lang.Object
jadex.collection.ObjectCache
All Implemented Interfaces:
Serializable

public class ObjectCache extends Object implements 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 Details

    • persist_always

      protected boolean persist_always
      The persist strategy (always or only on demand by manually calling persist).
    • persist_single

      protected boolean persist_single
      The flag indicating if cached objects are stored on disk themselves.
    • filename

      protected String filename
      The filename of the cache.
    • cache

      protected Map<String,CachedObject> cache
      The expression caches for filename.
  • Constructor Details

    • ObjectCache

      public ObjectCache(String filename)
      Create a new cache.
    • ObjectCache

      public ObjectCache(String filename, boolean persist_always, boolean persist_single)
      Create a new cache.
    • ObjectCache

      public ObjectCache(String filename, boolean persist_always, boolean persist_single, int max)
      Create a new cache.
  • Method Details

    • loadCachedObject

      public CachedObject loadCachedObject(String filename, long lastmodified)
      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

      public void add(CachedObject co)
      Add a cached object.
      Parameters:
      co - The new object.
    • remove

      public void remove(String filename)
      Add a cached object.
      Parameters:
      filename - The filename.
    • persist

      public void persist() throws IOException
      Presist the cached object.
      Throws:
      IOException
    • clear

      public void clear()
      Clear the cache.
    • loadObjectCache

      public static ObjectCache loadObjectCache(String filename)
      Load the model cache.
      Parameters:
      filename - The filename.
      Returns:
      The object cache.