com.bankframe.services.cache
Class MergedDataPacketsCache

java.lang.Object
  extended by com.bankframe.services.cache.GenericCache
      extended by com.bankframe.services.cache.MergedDataPacketsCache
All Implemented Interfaces:
Cache, NamedCache, PersistentCache, Map

public class MergedDataPacketsCache
extends GenericCache

The class is a specialisation of the GenericCache class. When a put() or putAll() method is invoked where the values are DataPackets then if a matching key already exists then the old DataPacket value and the new DataPacket value are merged.

Where a field in the DataPacket exists in both the old and the new version the old value of the field is overwritten with the new value of the field.

With GenericCache the old DataPacket value is simply overwritten with the new value.

To configure a cache to use this Cache implementation adjust the cache.cacheName.class setting in the BankframeResource.properties file This cache can only be used to store DataPacket data.

For example to change the txnPersister cache to use this cache implementation use the following setting: cache.txnPersister.class=com.bankframe.services.cache.MergedDataPacketsCache


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
MergedDataPacketsCache()
          Default Constructor
MergedDataPacketsCache(CachePolicy policy)
           
MergedDataPacketsCache(Map persistentMap)
           
MergedDataPacketsCache(Map persistentMap, CachePolicy policy)
           
 
Method Summary
 Object put(Object key, Object value)
          This method updates the specified object to the data-store.
 void putAll(Map values)
          This method places the specified values in the cache and the data-store.
 
Methods inherited from class com.bankframe.services.cache.GenericCache
addCacheListener, cleanup, clear, containsKey, containsValue, enableCaching, entrySet, equals, get, getCachePolicy, getFromPersistentMap, getName, getPersistentMap, hashCode, isEmpty, keySet, remove, remove, removeAll, removeCacheListener, setCachePolicy, setName, setPersistentMap, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MergedDataPacketsCache

public MergedDataPacketsCache()
Default Constructor


MergedDataPacketsCache

public MergedDataPacketsCache(CachePolicy policy)
Parameters:
policy -

MergedDataPacketsCache

public MergedDataPacketsCache(Map persistentMap)
Parameters:
persistentMap -

MergedDataPacketsCache

public MergedDataPacketsCache(Map persistentMap,
                              CachePolicy policy)
Parameters:
persistentMap -
policy -
Method Detail

put

public Object put(Object key,
                  Object value)
Description copied from class: GenericCache
This method updates the specified object to the data-store. It also updates the reference stored in the cache. If the object does not exist in the data-store it will be created.

Specified by:
put in interface Map
Overrides:
put in class GenericCache
Parameters:
key - Unique key identifying the object
value - The object

putAll

public void putAll(Map values)
Description copied from class: GenericCache
This method places the specified values in the cache and the data-store. :param values a map of values to add to the cache.

Specified by:
putAll in interface Map
Overrides:
putAll in class GenericCache


Copyright © 2005, 2007, Oracle. All rights reserved.