SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

com.solarmetric.kodo.runtime.datacache.query
Interface QueryCache

All Known Implementing Classes:
QueryCacheImpl

public interface QueryCache

Interface that must be implemented by any level 2 query cache used by Kodo. These methods should be synchronized.

Since:
2.5.0

Method Summary
 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.
 List get(QueryKey qk)
          Return a list of OIDs for the given query key.
 com.solarmetric.util.Listener getExpirationListener()
          Returns this query cache's expiration listener.
 void notifyChangedClasses(Set 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 registerClassChangeListener(ClassChangeListener ccl)
          Register ccl with this cache.
 List remove(QueryKey qk)
          Remove the value stored under the given query key.
 boolean unpin(QueryKey qk)
          Unpin the value stored under key into the cache.
 void unregisterClassChangeListener(ClassChangeListener ccl)
          Unregister ccl from the set of listeners managed by this cache.
 

Method Detail

notifyChangedClasses

public void notifyChangedClasses(Set 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.

Parameters:
classes - a Set of Class objects that correspond to instances that have changed

registerClassChangeListener

public void registerClassChangeListener(ClassChangeListener ccl)
Register ccl with this cache.

unregisterClassChangeListener

public void unregisterClassChangeListener(ClassChangeListener ccl)
Unregister ccl from the set of listeners managed by this cache.

get

public List get(QueryKey qk)

Return a list of OIDs for the given query key. This is an unmodifiable list.

Returns:
the query results matching the given key, or null if none.

put

public List put(QueryKey qk,
                List 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.

Returns:
The previously cached value, or null if the key was not previously cached. See Map.put(java.lang.Object, java.lang.Object) for more information.

remove

public List 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 #notifyChanges, which will result in all queries that may be invalid being dropped.

Returns:
The previously cached value, or null if the key was not previously cached. See Map.remove(java.lang.Object) for more information.

clear

public void clear()

Remove all data from this cache.


pin

public boolean pin(QueryKey qk)
Pin the value stored under 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(com.solarmetric.kodo.runtime.datacache.query.QueryKey) or #notifyChanges.
Returns:
true if key's value was pinned into the cache; false if the key is not in the cache.

unpin

public boolean unpin(QueryKey qk)
Unpin the value stored under key into the cache. This method reverses a previous invocation of pin(com.solarmetric.kodo.runtime.datacache.query.QueryKey). This method does not remove anything from the cache; it merely makes key's value a candidate for flushing from the cache.
Returns:
true if key's value was unpinned from the cache; false if the key is not in the cache.

close

public void close()
Close this cache, dropping all hard references and releasing any resources that this cache maintains.

getExpirationListener

public com.solarmetric.util.Listener getExpirationListener()
Returns this query cache's expiration listener.

SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

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