|
SolarMetric Kodo JDO Enterprise Edition 2.3.1 generated on August 20 2002 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.solarmetric.kodo.runtime.datacache.plugins.LocalCache
A single-PersistenceManagerFactory cache. This cache can be used to share data among PersistenceManagers created from a single PersistenceManagerFactory. Batch updates are performed atomically.
| Field Summary | |
protected CacheMap |
cache
|
| Constructor Summary | |
LocalCache()
|
|
| Method Summary | |
void |
batchUpdate(Map additions,
Map updates,
Collection deletes,
Object origin)
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. |
Object |
get(Object key)
Return the cached object for the given key. |
int |
getCacheSize()
Returns the maximum number of unpinned objects to keep hard references to. |
CacheMap |
newCacheMap()
Returns a new CacheMap for use as the underlying data
cache. |
boolean |
pin(Object key)
Pin the value stored under key into the cache. |
Object |
put(Object key,
Object value)
Set the cached value for the given key. |
Object |
remove(Object key)
Remove the value stored under the given key. |
void |
removeAll(Collection keys)
|
void |
setCacheSize(int size)
Sets the maximum number of unpinned objects to keep hard references to. |
boolean |
unpin(Object key)
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 CacheMap cache
| Constructor Detail |
public LocalCache()
| Method Detail |
public void setCacheSize(int size)
size, then this method will result in the cache
flushing old values.public int getCacheSize()
public 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 batchUpdate(Map additions,
Map updates,
Collection deletes,
Object origin)
DataCachePerform a batch update of the cache. Add all key-value
pairs in additions, make the appropriate
modifications to all key-value pairs in updates,
and delete all keys in deletes. Processing the
updates map might involve adding or removing
objects to the cache or modifying data already in the
cache.
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.DataCacheorigin - the object that initiated this cache
update. This can be useful for
implementations in which many sources
share a single cache, which in turn
communicates back to the sources on cache
updates.public Object get(Object key)
DataCacheDataCache.put(java.lang.Object, java.lang.Object)
method should be used to re-cache any changed objects.get in interface DataCachecom.solarmetric.kodo.runtime.datacache.DataCache
public Object put(Object key,
Object value)
DataCacheDataCache.batchUpdate(java.util.Map, java.util.Map, java.util.Collection, java.lang.Object) 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 Object remove(Object key)
DataCachebatchUpdate 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 removeAll(Collection keys)
public void clear()
DataCachebatchUpdate 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 remove.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 DataCache
|
SolarMetric Kodo JDO Enterprise Edition 2.3.1 generated on August 20 2002 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||