|
SolarMetric Kodo JDO 3.3.5 generated on August 31 2005 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface that must be implemented by any level 2 query cache
used by Kodo. These methods should be synchronized.
Most query cache implementations will probably implement
Configurable
to receive a handle to the
system configuration on construction.
Method Summary | |
void |
addExpirationListener(ExpirationListener listen)
Add a new expiration event listener to this cache. |
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. |
void |
close()
Free the resources used by this cache. |
QueryResult |
get(QueryKey qk)
Return a list of oids for the given query key. |
boolean |
pin(QueryKey qk)
Pin the value stored under qk into the
cache. |
QueryResult |
put(QueryKey qk,
QueryResult oids)
Set the list of OIDs for the given query key. |
QueryResult |
remove(QueryKey qk)
Remove the value stored under the given query key. |
boolean |
removeExpirationListener(ExpirationListener listen)
Remove an expiration event listener from this cache. |
boolean |
unpin(QueryKey qk)
Unpin the value stored under key into the cache. |
Method Detail |
public void classesChanged(Collection classes)
Tells 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.
classes
- a set of Class
objects that
correspond to instances that have changedpublic QueryResult get(QueryKey qk)
Return a list of oids for the given query key. This is an unmodifiable list.
public QueryResult put(QueryKey qk, QueryResult oids)
Set 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.
null
if
the key was not previously cached. See Map.put(java.lang.Object, java.lang.Object)
for more information.public QueryResult remove(QueryKey qk)
Remove 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.
null
if
the key was not previously cached. See Map.remove(java.lang.Object)
for more information.public void clear()
Remove all data from this cache.
public boolean pin(QueryKey qk)
qk
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 remove(kodo.datacache.QueryKey)
or #notifyChangedClasses
.true
if key
's value was
pinned into the cache; false
if the
key is not in the cache.public boolean unpin(QueryKey qk)
key
into the cache.
This method reverses a previous invocation of 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.true
if key
's value was
unpinned from the cache; false
if the
key is not in the cache.public void addExpirationListener(ExpirationListener listen)
public boolean removeExpirationListener(ExpirationListener listen)
public void close()
close
in interface com.solarmetric.util.Closeable
|
SolarMetric Kodo JDO 3.3.5 generated on August 31 2005 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |