stomp.jdo.kodo
Class UpdatingLocalCache

java.lang.Object
  |
  +--com.solarmetric.kodo.runtime.datacache.plugins.LocalCache
        |
        +--stomp.jdo.kodo.UpdatingLocalCache
All Implemented Interfaces:
com.solarmetric.kodo.runtime.datacache.DataCache

public class UpdatingLocalCache
extends com.solarmetric.kodo.runtime.datacache.plugins.LocalCache

Single JVM cache which transitions read-only objects to hollow when it becomes aware that their database information has changed (because a transaction occurs). The next read of this object will result in a trip to the database to fetch the new information (unless the transaction occurred in this JVM, in which case the information may be read from a LocalCache).

To use this cache, set com.solarmetric.kodo.DataCacheClass to stomp.jdo.kodo.UpdatingLocalCache,

	com.solarmetric.kodo.DataCacheClass=samples.updatingCache.UpdatingLocalCache
	

Author:
Eric Lindauer

Field Summary
 
Fields inherited from class com.solarmetric.kodo.runtime.datacache.plugins.LocalCache
cache
 
Constructor Summary
UpdatingLocalCache()
           
 
Method Summary
 void batchUpdate(java.util.Map additions, java.util.Map updates, java.util.Collection deletes, java.lang.Object origin)
          Callback made when a transaction in this JVM changes the database information for a persistent object.
 void setSchemaGroup(java.lang.String group)
          Must be called when this cache is initialized.
 
Methods inherited from class com.solarmetric.kodo.runtime.datacache.plugins.LocalCache
clear, close, get, getCacheMap, getCacheSize, newCacheMap, pin, put, remove, removeAll, setCacheSize, unpin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdatingLocalCache

public UpdatingLocalCache()
Method Detail

setSchemaGroup

public void setSchemaGroup(java.lang.String group)
Must be called when this cache is initialized. This would be the constructor, but we are forced to have a no-args constructor to integrate with Kodo.


batchUpdate

public void batchUpdate(java.util.Map additions,
                        java.util.Map updates,
                        java.util.Collection deletes,
                        java.lang.Object origin)
Callback made when a transaction in this JVM changes the database information for a persistent object. This method evicts the read-only instances for all changed and deleted ids, so the database changes are immediately visible in the read-only version of objects.

Specified by:
batchUpdate in interface com.solarmetric.kodo.runtime.datacache.DataCache
Overrides:
batchUpdate in class com.solarmetric.kodo.runtime.datacache.plugins.LocalCache