com.basecmp.core.persistence.impl
Class AssetCacheMgr

java.lang.Object
  extended byAbstractHelper
      extended bycom.basecmp.core.persistence.impl.AssetCacheMgr

public class AssetCacheMgr
extends AbstractHelper

Object-cache for instances of PersistentAsset. AssetCacheMgr is implemented as a singleton and provides read-access to the cache via static method get(). The cache itself is backed by an LRU-Map (Apache Commons Collection) and is fully event-controlled. The private contructor is called via a "static contructor" and registers itself for the persistence-eventtypes ReadEvent, SaveEvent, DeleteEvent and BindingEvent. AssetCacheMgr is currently disabled by default. Caching can be enabled with the Config-Variable 'persistence.assethandling.enableCache' set 'true' in system-configfile. The cachesize is currently limited to 5000 instances. AssetCacheMgr is used by PersistentAssetFactory to provide transparent object-caching. Other classes may use the cache but this is not recommended.

See Also:
Serialized Form
Author:
Wolfgang Schröder

Field Summary
static int CACHECONTROL_ADD
           
static int CACHECONTROL_DROP
           
static int CACHECONTROL_UPDATE
           
static int DEFAULT_MAX_CACHE_SIZE
           
 
Method Summary
static boolean contains(java.lang.Long cid)
           
protected static int currentReferenceNavigationMapSize()
           
protected static int currentReferenceNavigationSize()
           
static int currentSize()
           
static void flushAll()
           
static PersistentAsset get(java.lang.Long cid)
          Delivers an instance of PersistentAsset from the Object-Cache or null, if the asset with the given cid is not present in the object-cache.
static int[] getStats()
          Returns runtime-statistics of the cache-manager of the running measuring internval.
static boolean isActive()
           
protected  void load()
          Empty implementation.
static int maxSize()
           
 void processEvent(java.util.EventObject event)
          Processes the events sent by persistence-layer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CACHECONTROL_ADD

public static final int CACHECONTROL_ADD
See Also:
Constant Field Values

CACHECONTROL_DROP

public static final int CACHECONTROL_DROP
See Also:
Constant Field Values

CACHECONTROL_UPDATE

public static final int CACHECONTROL_UPDATE
See Also:
Constant Field Values

DEFAULT_MAX_CACHE_SIZE

public static final int DEFAULT_MAX_CACHE_SIZE
See Also:
Constant Field Values
Method Detail

contains

public static boolean contains(java.lang.Long cid)

currentReferenceNavigationMapSize

protected static int currentReferenceNavigationMapSize()

currentReferenceNavigationSize

protected static int currentReferenceNavigationSize()

currentSize

public static int currentSize()

flushAll

public static void flushAll()

get

public static PersistentAsset get(java.lang.Long cid)
Delivers an instance of PersistentAsset from the Object-Cache or null, if the asset with the given cid is not present in the object-cache.


getStats

public static int[] getStats()
Returns runtime-statistics of the cache-manager of the running measuring internval. Order of values is:

Returns:

isActive

public static boolean isActive()

load

protected void load()
Empty implementation.


maxSize

public static int maxSize()

processEvent

public void processEvent(java.util.EventObject event)
Processes the events sent by persistence-layer.



Copyright © 2004 by basecmp® - Professional Web Solutions