org.apertereports.util.cache
Class MapCache

java.lang.Object
  extended by org.apertereports.util.cache.MapCache

public class MapCache
extends Object

A simple map cache. Each instance has its own generated id. The id is used to identify the cache within the cache-monitoring thread in MapCacheManager.


Constructor Summary
MapCache()
          Constructs a new instance with a generated id.
 
Method Summary
 void cacheData(String key, long interval, Object data)
          Caches the data internally and registers the cached object in the MapCacheManager.
protected  void clearCache()
           
 String getId()
           
protected  void invalidateObject(String key)
           
 Object provideData(String key)
          Provides the object identified by key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapCache

public MapCache()
Constructs a new instance with a generated id.

Method Detail

cacheData

public void cacheData(String key,
                      long interval,
                      Object data)
Caches the data internally and registers the cached object in the MapCacheManager. Each object is identified with a key and an interval of time the cache is valid.

The interval of value 0 means the object should never be cached.

On the other hand, the interval of value -1 means the object is to be cached forever.

Parameters:
key - Object key
interval - Interval the cache is valid
data - Cached object

provideData

public Object provideData(String key)
Provides the object identified by key.

Parameters:
key - Object key
Returns:
Cached object

clearCache

protected void clearCache()

invalidateObject

protected void invalidateObject(String key)

getId

public String getId()


Copyright © 2011-2012. All Rights Reserved.