Requirements for Transactional Caches

The objects you store in your transactional cache must:

  • Implement java.io.Serializable—This is required to store cached objects when the cache is distributed in a Terracotta cluster, and it is also required by the copy-on-read / copy-on-write mechanism used to implement isolation.
  • Override equals and hashcode — These must be overridden because the transactional stores rely on element value comparison. See: ElementValueComparator and the elementValueComparator configuration setting.

Additional restrictions:

  • Transactional mode with terracotta consistency="strong".
  • Caches can be dynamically changed to bulk-load mode, but any attempt to perform a transaction when this is the case causes a CacheException to be thrown.
  • If using "xa_strict", set synchronous writes (in ehcache.xml) to prevent potential loss of unwritten data on the client:

    <terracotta synchronousWrites="true" />