Kodo 4.1.0 generated on October 9 2006

kodo.datacache
Class LRUDataCache

java.lang.Object
  extended by org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
      extended by org.apache.openjpa.datacache.AbstractDataCache
          extended by kodo.datacache.LRUDataCache
All Implemented Interfaces:
org.apache.openjpa.datacache.DataCache, org.apache.openjpa.event.RemoteCommitListener, org.apache.openjpa.lib.conf.Configurable, org.apache.openjpa.lib.util.Closeable, org.apache.openjpa.lib.util.EventManager

public class LRUDataCache
extends org.apache.openjpa.datacache.AbstractDataCache
implements org.apache.openjpa.event.RemoteCommitListener

An lru-based data cache.


Field Summary
 
Fields inherited from class org.apache.openjpa.datacache.AbstractDataCache
conf, log
 
Fields inherited from interface org.apache.openjpa.datacache.DataCache
NAME_DEFAULT
 
Constructor Summary
LRUDataCache()
           
 
Method Summary
protected  void clearInternal()
           
 org.apache.openjpa.util.CacheMap getCacheMap()
          Returns the underlying CacheMap that this LRUDataCache is using.
 int getCacheSize()
          Returns the maximum number of unpinned objects to keep hard references to.
protected  org.apache.openjpa.datacache.DataCachePCData getInternal(Object key)
           
 int getSoftReferenceSize()
          Returns the maximum number of unpinned objects to keep soft references to.
 void initialize(org.apache.openjpa.datacache.DataCacheManager mgr)
           
protected  boolean pinInternal(Object key)
           
protected  org.apache.openjpa.datacache.DataCachePCData putInternal(Object key, org.apache.openjpa.datacache.DataCachePCData pc)
           
protected  void removeAllInternal(Class cls, boolean subs)
           
protected  org.apache.openjpa.datacache.DataCachePCData removeInternal(Object key)
           
 void setCacheSize(int size)
          Sets the maximum number of unpinned objects to keep hard references to.
 void setSoftReferenceSize(int size)
          Sets the maximum number of unpinned objects to keep soft references to.
protected  boolean unpinInternal(Object key)
           
 void writeLock()
           
 void writeUnlock()
           
 
Methods inherited from class org.apache.openjpa.datacache.AbstractDataCache
addExpirationListener, afterCommit, clear, close, close, commit, contains, containsAll, endConfiguration, fireEvent, get, getEvictionSchedule, getName, isClosed, keyRemoved, pin, pinAll, pinAll, put, putAllInternal, recacheUpdates, remove, removeAll, removeAll, removeAllInternal, removeAllTypeNamesInternal, removeExpirationListener, setConfiguration, setEvictionSchedule, setName, startConfiguration, toString, unpin, unpinAll, unpinAll, update
 
Methods inherited from class org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
addListener, fireEvent, getListeners, hasListener, hasListeners, isFailFast, newListenerCollection, removeListener, setFailFast
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.event.RemoteCommitListener
afterCommit, close
 

Constructor Detail

LRUDataCache

public LRUDataCache()
Method Detail

getCacheMap

public org.apache.openjpa.util.CacheMap getCacheMap()
Returns the underlying CacheMap that this LRUDataCache is using. This is not an unmodifiable view on the map, so care should be taken with this reference. Implementations should probably not modify the contents of the cache, but should only use this reference to obtain cache metrics.


setCacheSize

public void setCacheSize(int size)
Sets the maximum number of unpinned objects to keep hard references to. If the map contains more unpinned objects than size, then this method will result in the cache flushing old values.


getCacheSize

public int getCacheSize()
Returns the maximum number of unpinned objects to keep hard references to.


setSoftReferenceSize

public void setSoftReferenceSize(int size)
Sets the maximum number of unpinned objects to keep soft references to. If the map contains more soft references than size, then this method will result in the cache flushing values.


getSoftReferenceSize

public int getSoftReferenceSize()
Returns the maximum number of unpinned objects to keep soft references to. Defaults to -1.


initialize

public void initialize(org.apache.openjpa.datacache.DataCacheManager mgr)
Specified by:
initialize in interface org.apache.openjpa.datacache.DataCache
Overrides:
initialize in class org.apache.openjpa.datacache.AbstractDataCache

writeLock

public void writeLock()
Specified by:
writeLock in interface org.apache.openjpa.datacache.DataCache

writeUnlock

public void writeUnlock()
Specified by:
writeUnlock in interface org.apache.openjpa.datacache.DataCache

getInternal

protected org.apache.openjpa.datacache.DataCachePCData getInternal(Object key)
Specified by:
getInternal in class org.apache.openjpa.datacache.AbstractDataCache

putInternal

protected org.apache.openjpa.datacache.DataCachePCData putInternal(Object key,
                                                                   org.apache.openjpa.datacache.DataCachePCData pc)
Specified by:
putInternal in class org.apache.openjpa.datacache.AbstractDataCache

removeInternal

protected org.apache.openjpa.datacache.DataCachePCData removeInternal(Object key)
Specified by:
removeInternal in class org.apache.openjpa.datacache.AbstractDataCache

removeAllInternal

protected void removeAllInternal(Class cls,
                                 boolean subs)
Specified by:
removeAllInternal in class org.apache.openjpa.datacache.AbstractDataCache

clearInternal

protected void clearInternal()
Specified by:
clearInternal in class org.apache.openjpa.datacache.AbstractDataCache

pinInternal

protected boolean pinInternal(Object key)
Specified by:
pinInternal in class org.apache.openjpa.datacache.AbstractDataCache

unpinInternal

protected boolean unpinInternal(Object key)
Specified by:
unpinInternal in class org.apache.openjpa.datacache.AbstractDataCache

Kodo 4.1.0 generated on October 9 2006

Copyright 2001-2006 BEA Systems, Inc. All Rights Reserved.