|
SolarMetric Kodo JDO 3.4.1 generated on May 30 2006 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--serp.util.AbstractEventManager
|
+--kodo.datacache.AbstractQueryCache
Abstract QueryCache implementation that provides various
statistics, logging, and timeout functionality common across cache
implementations.
| Field Summary | |
protected JDOConfiguration |
conf
The configuration set by the system. |
protected Log |
log
The log to use. |
| Constructor Summary | |
AbstractQueryCache()
|
|
| Method Summary | |
void |
addExpirationListener(ExpirationListener listen)
Add a new expiration event listener to this cache. |
void |
afterCommit(RemoteCommitEvent event)
This method is part of the RemoteCommitListener interface. |
void |
classesChanged(Collection classes)
Tells the cache that all the classes in the classes set have been changed. |
void |
clear()
Remove all data from this cache. |
protected abstract void |
clearInternal()
Clear the cache. |
void |
close()
Free the resources used by this cache. |
protected void |
closeWithoutClear()
|
void |
endConfiguration()
Invoked upon completion of bean property configuration for this object. |
protected void |
fireEvent(Object event,
Object listener)
|
QueryResult |
get(QueryKey key)
Return a list of oids for the given query key. |
double |
getHitRate()
Returns the percentage of hits. |
int |
getHits()
Returns the number of cache hits for invocations of the get(kodo.datacache.QueryKey)
method. |
protected abstract QueryResult |
getInternal(QueryKey qk)
Return the list for the given key. |
int |
getMisses()
Returns the number of cache misses for invocations of the get(kodo.datacache.QueryKey)
method. |
Collection |
getStatistics()
Get statistics exported by this object. |
String |
getStatisticsString()
Returns a localized string containing the number of hits, the number of misses, and the hit ratio ( hits / (hits+misses)). |
boolean |
isClosed()
|
protected void |
keyRemoved(Object key,
boolean expired)
Invoke when a key is removed from this cache. |
protected abstract Collection |
keySet()
Return a threadsafe view of the keys in this cache. |
protected Collection |
newListenerCollection()
Individual query results will be registered as expiration listeners. |
boolean |
pin(QueryKey key)
Pin the value stored under qk into the
cache. |
protected abstract boolean |
pinInternal(QueryKey qk)
Pin an object to the cache. |
QueryResult |
put(QueryKey qk,
QueryResult oids)
Set the list of OIDs for the given query key. |
protected abstract QueryResult |
putInternal(QueryKey qk,
QueryResult oids)
Add the given result to the cache, returning the old result under the given key. |
QueryResult |
remove(QueryKey key)
Remove the value stored under the given query key. |
protected void |
removeAllInternal(Collection qks)
Remove all results under the given keys from the cache. |
boolean |
removeExpirationListener(ExpirationListener listen)
Remove an expiration event listener from this cache. |
protected abstract QueryResult |
removeInternal(QueryKey qk)
Remove the result under the given key from the cache. |
void |
resetStatistics()
Reset the caching statistics. |
void |
setConfiguration(Configuration conf)
Invoked prior to setting bean properties. |
void |
startConfiguration()
Invoked before bean property configuration is begun on this object. |
boolean |
unpin(QueryKey key)
Unpin the value stored under key into the cache. |
protected abstract boolean |
unpinInternal(QueryKey qk)
Unpin an object from the cache. |
| 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 |
| Field Detail |
protected JDOConfiguration conf
protected Log log
| Constructor Detail |
public AbstractQueryCache()
| Method Detail |
public void classesChanged(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.
classesChanged in interface QueryCachekodo.datacache.QueryCacheclasses - a set of Class objects that
correspond to instances that have changedpublic QueryResult get(QueryKey key)
QueryCacheReturn a list of oids for the given query key. This is an unmodifiable list.
get in interface QueryCachekodo.datacache.QueryCache
public QueryResult put(QueryKey qk,
QueryResult 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 QueryResult remove(QueryKey key)
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 #notifyChangedClasses, 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 boolean pin(QueryKey key)
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 #notifyChangedClasses.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 key)
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 clear()
QueryCacheRemove all data from this cache.
clear in interface QueryCachepublic void close()
QueryCacheclose in interface QueryCacheprotected void closeWithoutClear()
public boolean isClosed()
public void addExpirationListener(ExpirationListener listen)
QueryCacheaddExpirationListener in interface QueryCachepublic boolean removeExpirationListener(ExpirationListener listen)
QueryCacheremoveExpirationListener in interface QueryCachepublic void afterCommit(RemoteCommitEvent event)
RemoteCommitListener interface. If
your cache subclass relies on Kodo for clustering support, make it
implement RemoteCommitListener. This method will take
care of invalidating entries from remote commits, by delegating to
classesChanged(java.util.Collection).
protected void keyRemoved(Object key,
boolean expired)
protected abstract Collection keySet()
protected abstract QueryResult getInternal(QueryKey qk)
protected abstract QueryResult putInternal(QueryKey qk,
QueryResult oids)
protected abstract QueryResult removeInternal(QueryKey qk)
protected void removeAllInternal(Collection qks)
protected abstract void clearInternal()
protected abstract boolean pinInternal(QueryKey qk)
protected abstract boolean unpinInternal(QueryKey qk)
public int getHits()
get(kodo.datacache.QueryKey)
method.public int getMisses()
get(kodo.datacache.QueryKey)
method.public double getHitRate()
public String getStatisticsString()
hits / (hits+misses)).public Collection getStatistics()
public void resetStatistics()
public void setConfiguration(Configuration conf)
ConfigurablesetConfiguration in interface Configurablepublic void startConfiguration()
ConfigurablestartConfiguration in interface Configurablepublic void endConfiguration()
ConfigurableendConfiguration in interface Configurable
protected void fireEvent(Object event,
Object listener)
fireEvent in class serp.util.AbstractEventManagerprotected Collection newListenerCollection()
newListenerCollection in class serp.util.AbstractEventManager
|
SolarMetric Kodo JDO 3.4.1 generated on May 30 2006 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||