|
SolarMetric Kodo JDO 3.2.4 generated on January 7 2005 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--kodo.datacache.QueryCacheImpl
Default query cache implementation.
| Field Summary | |
protected Configuration |
_conf
|
| Constructor Summary | |
QueryCacheImpl()
|
|
| Method Summary | |
void |
classesChanged(Collection classes)
Invoked when objects of the types in the classes set have been changed. |
void |
clear()
Remove all data from this cache. |
void |
close()
Close this cache, dropping all hard references and releasing any resources that this cache maintains. |
void |
endConfiguration()
Invoked upon completion of bean property configuration for this object. |
List |
get(QueryKey qk)
Return a list of OIDs for the given query key. |
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. |
QueryKeyExpirationListener |
getExpirationListener()
Returns this query cache's expiration listener. |
int |
getSoftReferenceSize()
Returns the maximum number of unpinned objects to keep soft references to. |
protected CacheMap |
newCacheMap()
Returns a new CacheMap for use as the underlying data
cache. |
void |
notifyChangedClasses(Collection classes)
Tells the cache that all the classes in the classes set have been changed. |
boolean |
pin(QueryKey qk)
Pin the value stored under qk into the
cache. |
List |
put(QueryKey qk,
List oids)
Set the list of OIDs for the given query key. |
void |
registerListener(ClassChangeListener ccl)
Register ccl with this cache. |
List |
remove(QueryKey qk)
Remove the value stored under the given query key. |
void |
removeListener(ClassChangeListener ccl)
Unregister ccl from the set of listeners managed
by this cache. |
void |
setCacheSize(int size)
Sets the maximum number of unpinned objects to keep hard references to. |
void |
setConfiguration(Configuration conf)
Invoked prior to setting bean properties. |
void |
setSoftReferenceSize(int size)
Sets the maximum number of unpinned objects to keep soft references to. |
void |
startConfiguration()
Invoked before bean property configuration is begun on this object. |
boolean |
unpin(QueryKey qk)
Unpin the value stored under key into the cache. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected Configuration _conf
| Constructor Detail |
public QueryCacheImpl()
| Method Detail |
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.
public void setCacheSize(int size)
size, then this method will result in the cache
flushing old values.public int getCacheSize()
public void setSoftReferenceSize(int size)
size, then this method will result in the cache
flushing values.public int getSoftReferenceSize()
-1.protected CacheMap newCacheMap()
CacheMap for use as the underlying data
cache. This implementation returns a CacheMap. To
implement a more sophisticated caching strategy, override this
method to return a subclass of CacheMap.public void notifyChangedClasses(Collection classes)
QueryCacheTells the cache that all the classes in the
classes set have been changed. This could mean
that items have been updated, deleted, or added. This limits
the QueryCache to only be able to invalidate
cached queries -- because the cache is not notified of actual
changes, it cannot recompute query results.
After this method is invoked, all cached results that
correspond to queries that use one of the classes in
classes will be dropped.
notifyChangedClasses in interface QueryCachekodo.datacache.QueryCacheclasses - a set of Class objects that
correspond to instances that have changedpublic void registerListener(ClassChangeListener ccl)
QueryCacheccl with this cache.registerListener in interface QueryCachepublic void removeListener(ClassChangeListener ccl)
QueryCacheccl from the set of listeners managed
by this cache.removeListener in interface QueryCachepublic void classesChanged(Collection classes)
ClassChangeListenerInvoked when objects of the types in the
classes set have been changed. This could mean
that items have been updated, deleted, or added.
classesChanged in interface ClassChangeListenerkodo.datacache.ClassChangeListenerclasses - a set of Class objects that
correspond to instances that have changedpublic List get(QueryKey qk)
QueryCacheReturn a list of OIDs for the given query key. This is an unmodifiable list.
get in interface QueryCachekodo.datacache.QueryCache
public List put(QueryKey qk,
List oids)
QueryCacheSet the list of OIDs for the given query key. A reference to the given list will be stored in the query cache, so the list should not be modified after invoking this method.
put in interface QueryCachekodo.datacache.QueryCachenull if
the key was not previously cached. See Map.put(java.lang.Object, java.lang.Object)
for more information.public List remove(QueryKey qk)
QueryCacheRemove the value stored under the given query key.
This method is typically not invoked directly from outside
the QueryCache class. Instead, the cache should
be updated by invoking QueryCache.notifyChangedClasses(java.util.Collection), which will
result in all queries that may be invalid being dropped.
remove in interface QueryCachekodo.datacache.QueryCachenull if
the key was not previously cached. See Map.remove(java.lang.Object)
for more information.public void clear()
QueryCacheRemove all data from this cache.
clear in interface QueryCachepublic boolean pin(QueryKey qk)
QueryCacheqk into the
cache. This method guarantees that qk's value
will not be expired if the cache exceeds its capacity. It
causes this data to be ignored when determining whether or not
the cache is full, effectively increasing the total amount of
data stored in the cache. This method does not affect the
behavior of QueryCache.remove(kodo.datacache.QueryKey) or QueryCache.notifyChangedClasses(java.util.Collection).pin in interface QueryCachekodo.datacache.QueryCachetrue if key's value was
pinned into the cache; false if the
key is not in the cache.public boolean unpin(QueryKey qk)
QueryCachekey into the cache.
This method reverses a previous invocation of QueryCache.pin(kodo.datacache.QueryKey).
This method does not remove anything from the cache; it merely
makes key's value a candidate for flushing from
the cache.unpin in interface QueryCachekodo.datacache.QueryCachetrue if key's value was
unpinned from the cache; false if the
key is not in the cache.public void close()
QueryCacheclose in interface QueryCachepublic QueryKeyExpirationListener getExpirationListener()
QueryCachegetExpirationListener in interface QueryCachepublic void setConfiguration(Configuration conf)
ConfigurablesetConfiguration in interface Configurablepublic void startConfiguration()
ConfigurablestartConfiguration in interface Configurablepublic void endConfiguration()
ConfigurableendConfiguration in interface Configurable
|
SolarMetric Kodo JDO 3.2.4 generated on January 7 2005 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||