Class AbstractTransactionSupportingCacheManager

java.lang.Object
org.springframework.cache.support.AbstractCacheManager
org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.springframework.cache.CacheManager
Direct Known Subclasses:
JCacheCacheManager

public abstract class AbstractTransactionSupportingCacheManager extends org.springframework.cache.support.AbstractCacheManager
Base class for CacheManager implementations that want to support built-in awareness of Spring-managed transactions. This usually needs to be switched on explicitly through the setTransactionAware(boolean) bean property.
Since:
3.2
Author:
Juergen Hoeller
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.springframework.cache.Cache
    decorateCache(org.springframework.cache.Cache cache)
     
    boolean
    Return whether this CacheManager has been configured to be transaction-aware.
    void
    setTransactionAware(boolean transactionAware)
    Set whether this CacheManager should expose transaction-aware Cache objects.

    Methods inherited from class org.springframework.cache.support.AbstractCacheManager

    afterPropertiesSet, getCache, getCacheNames, getMissingCache, initializeCaches, loadCaches, lookupCache

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractTransactionSupportingCacheManager

      public AbstractTransactionSupportingCacheManager()
  • Method Details

    • setTransactionAware

      public void setTransactionAware(boolean transactionAware)
      Set whether this CacheManager should expose transaction-aware Cache objects.

      Default is "false". Set this to "true" to synchronize cache put/evict operations with ongoing Spring-managed transactions, performing the actual cache put/evict operation only in the after-commit phase of a successful transaction.

    • isTransactionAware

      public boolean isTransactionAware()
      Return whether this CacheManager has been configured to be transaction-aware.
    • decorateCache

      protected org.springframework.cache.Cache decorateCache(org.springframework.cache.Cache cache)
      Overrides:
      decorateCache in class org.springframework.cache.support.AbstractCacheManager