|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.solarmetric.kodo.runtime.datacache.TimedDataCache
DataCache decorator that is capable of expiring cache data.
| Constructor Summary | |
TimedDataCache(DataCache cache)
|
|
| Method Summary | |
void |
addExpirationListener(com.solarmetric.util.Listener listen)
Add a new expiration event listener to this cache. |
void |
batchUpdate(Collection additions,
Collection newUpdates,
Collection existingUpdates,
Collection deletes)
Perform a batch update of the cache. |
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. |
boolean |
containsKey(Object key)
Returns true if this cache contains data
corresponding to key; otherwise returns
false. |
PCData |
get(Object key)
Return the cached object for the given key. |
String |
getName()
Returns a string name that can be used by end-user-visible code to identify this cache. |
boolean |
isDecorator()
Returns true if this cache is a decorator that
wraps another cache. |
protected boolean |
isTimedOut(PCData data)
|
boolean |
pin(Object key)
Pin the value stored under key into the cache. |
PCData |
put(PCData value)
Set the cached value for the given key. |
PCData |
remove(Object key)
Remove the value stored under the given key. |
DataCache |
removeDecorator()
Returns an undecorated version of this cache. |
DataCache |
removeDecorators()
Returns the lowest cache in the chain of caches in this object. |
void |
removeExpirationListener(com.solarmetric.util.Listener listen)
Remove an expiration event listener from this cache. |
void |
setName(String name)
Sets a string name to be used to identify this cache to end-user needs. |
boolean |
unpin(Object key)
Unpin the value stored under key into the cache. |
void |
updateValue(PCData value)
Update the cached value for the given key. |
| Methods inherited from class java.lang.Object |
|
| Constructor Detail |
public TimedDataCache(DataCache cache)
| Method Detail |
protected boolean isTimedOut(PCData data)
public void batchUpdate(Collection additions,
Collection newUpdates,
Collection existingUpdates,
Collection deletes)
DataCachePerform a batch update of the cache. Add all PCData
objects in additions and in
newUpdates, make the appropriate modifications to
all PCDatas in existingUpdates, and delete all
OIDs in deletes.
All changes made to cached data must be cached via this method. It is this method that is responsible for performing any side-effects that should happen on meaningful cache changes.
Implementations should bear in mind that the
deletes collection may contain oids that are also
in the additions map. This is possible because it
is valid for a user to delete an object with a particular oid
and then add that object in the same batch.
batchUpdate in interface DataCachecom.solarmetric.kodo.runtime.datacache.DataCacheadditions - A collection of PCData objects. These
represent data that have been newly created,
and thus must be added to the cache.newUpdates - A collection of PCData objects. These
represent data that have been modified but
were not originally in the cache, and thus
must be added to the cache.existingUpdates - A collection of PCData objects. These
represent data that have been modified and
were originally loaded from the cache. It is
up to the cache implementation to decide if
these values must be re-enlisted in the cache.
Some caches may return live data from DataCache.get(java.lang.Object)
invocations, in which case these values need
not be re-enlisted.deletes - A collection of object IDs that have been deleted
and must therefore be dropped from the cache.public PCData get(Object key)
DataCacheDataCache.updateValue(com.solarmetric.kodo.runtime.PCData)
method should be used to re-cache any changed objects.get in interface DataCachecom.solarmetric.kodo.runtime.datacache.DataCachepublic PCData put(PCData value)
DataCacheDataCache.batchUpdate(java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection) method.put in interface DataCachecom.solarmetric.kodo.runtime.datacache.DataCachenull if
the key was not previously cached. See Map.put(java.lang.Object, java.lang.Object)
for more information.public void updateValue(PCData value)
DataCacheUpdate the cached value for the given key. This does not
result in an update of other caches. Rather, it should only be
used for loading clean data into the cache. Meaningful changes
to the state of the cache should be made via the
DataCache.batchUpdate(java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection) method.
A cache implementation may or may not return a live object
from DataCache.get(java.lang.Object) invocations. If an object retrieved from a
DataCache.get(java.lang.Object) operation needs to be updated, this method can be
invoked instead of invoking DataCache.put(com.solarmetric.kodo.runtime.PCData). The DataCache implementation
can then make optimizations based on how its DataCache.get(java.lang.Object) method
works.
updateValue in interface DataCachepublic PCData remove(Object key)
DataCacheDataCache.batchUpdate(java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection) method.remove in interface DataCachecom.solarmetric.kodo.runtime.datacache.DataCachenull if
the key was not previously cached. See Map.remove(java.lang.Object)
for more information.public void clear()
DataCacheDataCache.batchUpdate(java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection) method.clear in interface DataCachepublic boolean pin(Object key)
DataCachekey into the cache.
This method guarantees that key's value will not
be dropped by the caching algorithm. This method does not
affect the behavior of DataCache.remove(java.lang.Object).pin in interface DataCachecom.solarmetric.kodo.runtime.datacache.DataCachetrue if key's value was
pinned into the cache; false if the
key is not in the cache.public boolean unpin(Object key)
DataCachekey into the cache.
This method reverses a previous invocation of DataCache.pin(java.lang.Object).
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 DataCachecom.solarmetric.kodo.runtime.datacache.DataCachetrue if key's value was
unpinned from the cache; false if the
key is not in the cache.public void close()
DataCacheclose in interface DataCachepublic boolean containsKey(Object key)
DataCachetrue if this cache contains data
corresponding to key; otherwise returns
false.containsKey in interface DataCachepublic void setName(String name)
DataCachesetName in interface DataCachepublic String getName()
DataCachegetName in interface DataCachepublic boolean isDecorator()
DataCachetrue if this cache is a decorator that
wraps another cache. Otherwise, returns false.isDecorator in interface DataCachepublic DataCache removeDecorator()
DataCachethis.removeDecorator in interface DataCachepublic DataCache removeDecorators()
DataCachethis. This is equivalent to repeatedly invoking
DataCache.removeDecorator() until the returned DataCache returns
false from DataCache.isDecorator().removeDecorators in interface DataCachepublic void addExpirationListener(com.solarmetric.util.Listener listen)
DataCacheaddExpirationListener in interface DataCachepublic void removeExpirationListener(com.solarmetric.util.Listener listen)
DataCacheremoveExpirationListener in interface DataCache
|
SolarMetric Kodo JDO 2.5.8 generated on January 11 2004 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||