kodo.datacache
Class LRUDataCache
java.lang.Object
org.apache.openjpa.lib.util.concurrent.AbstractConcurrentEventManager
org.apache.openjpa.datacache.AbstractDataCache
kodo.datacache.LRUDataCache
- All Implemented Interfaces:
- Serializable, DataCache, RemoteCommitListener, Configurable, Closeable, EventManager
public class LRUDataCache
- extends AbstractDataCache
- implements RemoteCommitListener
An lru-based data cache.
- See Also:
- Serialized Form
Methods inherited from class org.apache.openjpa.datacache.AbstractDataCache |
addExpirationListener, afterCommit, clear, close, close, commit, contains, containsAll, endConfiguration, fireEvent, get, getAll, getEvictionSchedule, getName, isClosed, pin, pinAll, pinAll, put, putAllInternal, recacheUpdates, remove, removeAll, removeAll, removeAllInternal, removeAllTypeNamesInternal, removeExpirationListener, setConfiguration, setEvictionSchedule, setName, startConfiguration, toString, unpin, unpinAll, unpinAll, update |
LRUDataCache
public LRUDataCache()
getCacheMap
public 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(DataCacheManager mgr)
- Specified by:
initialize
in interface DataCache
- Overrides:
initialize
in class AbstractDataCache
writeLock
public void writeLock()
- Specified by:
writeLock
in interface DataCache
writeUnlock
public void writeUnlock()
- Specified by:
writeUnlock
in interface DataCache
getInternal
protected DataCachePCData getInternal(Object key)
- Specified by:
getInternal
in class AbstractDataCache
putInternal
protected DataCachePCData putInternal(Object key,
DataCachePCData pc)
- Specified by:
putInternal
in class AbstractDataCache
removeInternal
protected DataCachePCData removeInternal(Object key)
- Specified by:
removeInternal
in class AbstractDataCache
removeAllInternal
protected void removeAllInternal(Class cls,
boolean subs)
- Specified by:
removeAllInternal
in class AbstractDataCache
clearInternal
protected void clearInternal()
- Specified by:
clearInternal
in class AbstractDataCache
pinInternal
protected boolean pinInternal(Object key)
- Specified by:
pinInternal
in class AbstractDataCache
unpinInternal
protected boolean unpinInternal(Object key)
- Specified by:
unpinInternal
in class AbstractDataCache
keyRemoved
protected void keyRemoved(Object key,
boolean expired)
- Overrides:
keyRemoved
in class AbstractDataCache
Copyright 2001-2006 BEA Systems, Inc. All Rights Reserved.