Ehcache 2.10.8 | Product Documentation | Ehcache Developer Guide | Transaction Support | Configuring Transactional Cache
 
Configuring Transactional Cache
Transactions are enabled on a cache-by-cache basis with the transactionalMode cache attribute. The allowed values are:
*xa_strict
*xa
*local
*off
The default value is "off." In the following example, "xa_strict" is enabled.
<cache name="xaCache"
maxEntriesLocalHeap="500"
eternal="false"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
diskExpiryThreadIntervalSeconds="1"
transactionalMode="xa_strict">
</cache>
Transactional Caches with Spring
Note the following when using Spring:
*If you access the cache from an @Transactional Spring-annotated method, begin/commit/rollback statements are not required in application code because they are emitted by Spring.
*Both Spring and Ehcache need to access the transaction manager internally, and therefore you must inject your chosen transaction manager into Spring's PlatformTransactionManager as well as use an appropriate lookup strategy for Ehcache.
*The Ehcache default lookup strategy might not be able to detect your chosen transaction manager. For example, it cannot detect the WebSphere transaction manager. For additional information, see the Transaction Managers.
*Configuring a <tx:method> with read-only=true could be problematic with certain transaction managers such as WebSphere.

Copyright © 2010-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Innovation Release