|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.confluence.cache.TransactionalCacheFactory
public class TransactionalCacheFactory
A cache factory that produces transactional caches. These caches perform their updates only when the current transaction is successfully committed. Caches obtained outside of a transaction will pass updates immediately to the target cache while posting a warning to the cache factory log.
Transactional caches returned by this factory make a best effort at committing changes to the underlying cache, but they don't recover well from failure (caches with failures will be flushed), and there is no way that the associated database transaction can be rolled back if the cache updates fail. Cache updates that are to be performed outside of a transaction that are not transactionally significant can be performed via a cache obtained fromgetReadThroughCacheForUpdate(String). One example of such a use would
be cache read through.
Transaction synchronization is performed via the provided SynchronizationManager.
All updates to underlying caches are performed inside a lock on the cache to prevent other writes occurring at
the same time. This applies for updates done post-commit for transaction-based caches, as well as those done via
the read-through update method.
| Constructor Summary | |
|---|---|
TransactionalCacheFactory()
|
|
| Method Summary | |
|---|---|
Cache |
getCache(String cacheName)
Return the cache with the given name. |
Lock |
getLock(String cacheName)
Get a lock -- getting the lock does *not* imply that it has been acquired. |
Cache |
getReadThroughCacheForUpdate(String cacheName)
Returns the requested cache with no transactional wrapper for updates read from the database. |
void |
setCacheManager(CacheManager cacheManager)
|
void |
setLockFactory(LockFactory lockFactory)
|
void |
setSynchronizationManager(SynchronizationManager synchronizationManager)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TransactionalCacheFactory()
| Method Detail |
|---|
public void setCacheManager(CacheManager cacheManager)
public void setLockFactory(LockFactory lockFactory)
public void setSynchronizationManager(SynchronizationManager synchronizationManager)
public Cache getCache(String cacheName)
CacheFactory
getCache in interface CacheFactorypublic Cache getReadThroughCacheForUpdate(String cacheName)
Cache.put(Object, Object) are performed under the appropriate cache lock to
prevent concurrent writes.
getReadThroughCacheForUpdate in interface ReadThroughCacheFactorypublic Lock getLock(String cacheName)
LockFactoryLock.tryLock() or Lock.lock() on the returned object to
acquire the lock.
getLock in interface LockFactory
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||