SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

kodo.datacache
Class QueryCacheImpl

java.lang.Object
  |
  +--serp.util.AbstractEventManager
        |
        +--kodo.datacache.AbstractQueryCache
              |
              +--kodo.datacache.QueryCacheImpl
All Implemented Interfaces:
com.solarmetric.util.Closeable, Configurable, QueryCache, RemoteCommitListener

public class QueryCacheImpl
extends AbstractQueryCache
implements RemoteCommitListener

Default query cache implementation.


Fields inherited from class kodo.datacache.AbstractQueryCache
conf, log
 
Constructor Summary
QueryCacheImpl()
           
 
Method Summary
protected  void clearInternal()
          Clear the cache.
 void endConfiguration()
          Invoked upon completion of bean property configuration for this object.
 CacheMap getCacheMap()
          Returns the underlying CacheMap that this QueryCacheImpl is using.
 int getCacheSize()
          Returns the maximum number of unpinned objects to keep hard references to.
protected  QueryResult getInternal(QueryKey qk)
          Return the list for the given key.
 int getSoftReferenceSize()
          Returns the maximum number of unpinned objects to keep soft references to.
protected  Collection keySet()
          Return a threadsafe view of the keys in this cache.
protected  boolean pinInternal(QueryKey qk)
          Pin an object to the cache.
protected  QueryResult putInternal(QueryKey qk, QueryResult result)
          Add the given result to the cache, returning the old result under the given key.
protected  QueryResult removeInternal(QueryKey qk)
          Remove the result under the given key from the cache.
 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(QueryKey qk)
          Unpin an object from the cache.
 
Methods inherited from class kodo.datacache.AbstractQueryCache
addExpirationListener, afterCommit, classesChanged, clear, close, fireEvent, get, getHitRate, getHits, getMisses, getStatistics, getStatisticsString, isClosed, keyRemoved, pin, put, remove, removeAllInternal, removeExpirationListener, resetStatistics, setConfiguration, startConfiguration, unpin
 
Methods inherited from class serp.util.AbstractEventManager
fireEvent, getListeners, hasListener, hasListeners, registerListener, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface kodo.event.RemoteCommitListener
afterCommit, close
 

Constructor Detail

QueryCacheImpl

public QueryCacheImpl()
Method Detail

getCacheMap

public CacheMap getCacheMap()

Returns the underlying CacheMap that this QueryCacheImpl is using. This is not an unmodifiable view on the map, so care should be taken with this reference. Implementations should probably not mess with the contents of the cache, but should only use this reference to obtain cache metrics. Additionally, this map may contain expired data. Removal of timed-out data is done in a lazy fashion, so the actual size of the map may be greater than the number of non-expired query results in cache.

Methods that manipulate the cache map should synchronize on the map.


getCacheSize

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

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.

getSoftReferenceSize

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

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.

getInternal

protected QueryResult getInternal(QueryKey qk)
Description copied from class: AbstractQueryCache
Return the list for the given key.
Overrides:
getInternal in class AbstractQueryCache

putInternal

protected QueryResult putInternal(QueryKey qk,
                                  QueryResult result)
Description copied from class: AbstractQueryCache
Add the given result to the cache, returning the old result under the given key.
Overrides:
putInternal in class AbstractQueryCache

removeInternal

protected QueryResult removeInternal(QueryKey qk)
Description copied from class: AbstractQueryCache
Remove the result under the given key from the cache.
Overrides:
removeInternal in class AbstractQueryCache

clearInternal

protected void clearInternal()
Description copied from class: AbstractQueryCache
Clear the cache.
Overrides:
clearInternal in class AbstractQueryCache

pinInternal

protected boolean pinInternal(QueryKey qk)
Description copied from class: AbstractQueryCache
Pin an object to the cache.
Overrides:
pinInternal in class AbstractQueryCache

unpinInternal

protected boolean unpinInternal(QueryKey qk)
Description copied from class: AbstractQueryCache
Unpin an object from the cache.
Overrides:
unpinInternal in class AbstractQueryCache

keySet

protected Collection keySet()
Description copied from class: AbstractQueryCache
Return a threadsafe view of the keys in this cache. This collection must be iteratable without risk of concurrent modification exceptions. It does not have to implement contains() efficiently or use set semantics.
Overrides:
keySet in class AbstractQueryCache

endConfiguration

public void endConfiguration()
Description copied from interface: Configurable
Invoked upon completion of bean property configuration for this object.
Overrides:
endConfiguration in class AbstractQueryCache

SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.