public class TransactionalCacheFactory extends Object implements LockFactory, ReadThroughCacheFactory
getReadThroughCacheForUpdate(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 and Description |
---|
TransactionalCacheFactory(com.atlassian.cache.CacheFactory cacheFactory,
LockFactory lockFactory,
SynchronizationManager synchronizationManager,
ConfluenceMonitoring confluenceMonitoring) |
Modifier and Type | Method and Description |
---|---|
<K,V> com.atlassian.cache.Cache<K,V> |
getCache(Class<?> owningClass,
String name) |
<K,V> com.atlassian.cache.Cache<K,V> |
getCache(String name) |
<K,V> com.atlassian.cache.Cache<K,V> |
getCache(String name,
com.atlassian.cache.CacheLoader<K,V> loader) |
<K,V> com.atlassian.cache.Cache<K,V> |
getCache(String cacheName,
com.atlassian.cache.CacheLoader<K,V> loader,
com.atlassian.cache.CacheSettings required) |
<K,V> com.atlassian.cache.Cache<K,V> |
getCache(String name,
Class<K> keyType,
Class<V> valueType) |
<V> com.atlassian.cache.CachedReference<V> |
getCachedReference(Class<?> owningClass,
String name,
com.atlassian.cache.Supplier<V> supplier) |
<V> com.atlassian.cache.CachedReference<V> |
getCachedReference(Class<?> owningClass,
String name,
com.atlassian.cache.Supplier<V> supplier,
com.atlassian.cache.CacheSettings required) |
<V> com.atlassian.cache.CachedReference<V> |
getCachedReference(String name,
com.atlassian.cache.Supplier<V> supplier) |
<V> com.atlassian.cache.CachedReference<V> |
getCachedReference(String name,
com.atlassian.cache.Supplier<V> supplier,
com.atlassian.cache.CacheSettings required) |
Lock |
getLock(String cacheName)
Get a lock -- getting the lock does *not* imply that it has been acquired.
|
<K,V> com.atlassian.cache.Cache<K,V> |
getReadThroughCacheForUpdate(com.atlassian.cache.Cache<K,V> cache)
Returns the requested cache with no transactional wrapper for updates read from the database.
|
<K,V> com.atlassian.cache.Cache<K,V> |
getReadThroughCacheForUpdate(String cacheName)
Returns the requested cache with no transactional wrapper for updates read from the database.
|
public TransactionalCacheFactory(com.atlassian.cache.CacheFactory cacheFactory, LockFactory lockFactory, SynchronizationManager synchronizationManager, ConfluenceMonitoring confluenceMonitoring)
@Nonnull public <K,V> com.atlassian.cache.Cache<K,V> getCache(@Nonnull String cacheName, com.atlassian.cache.CacheLoader<K,V> loader, @Nonnull com.atlassian.cache.CacheSettings required)
getCache
in interface com.atlassian.cache.CacheFactory
public <K,V> com.atlassian.cache.Cache<K,V> getReadThroughCacheForUpdate(String cacheName)
Cache.put(Object, Object)
are performed under the appropriate cache lock to prevent concurrent writes.getReadThroughCacheForUpdate
in interface ReadThroughCacheFactory
public <K,V> com.atlassian.cache.Cache<K,V> getReadThroughCacheForUpdate(com.atlassian.cache.Cache<K,V> cache)
Cache.put(Object, Object)
are performed under the appropriate cache lock to prevent concurrent writes.getReadThroughCacheForUpdate
in interface ReadThroughCacheFactory
public Lock getLock(String cacheName)
LockFactory
Lock.tryLock()
or Lock.lock()
on the returned object to
acquire the lock.getLock
in interface LockFactory
@Nonnull public <K,V> com.atlassian.cache.Cache<K,V> getCache(@Nonnull String name, @Nonnull Class<K> keyType, @Nonnull Class<V> valueType)
getCache
in interface com.atlassian.cache.CacheFactory
@Nonnull public <K,V> com.atlassian.cache.Cache<K,V> getCache(@Nonnull Class<?> owningClass, @Nonnull String name)
getCache
in interface com.atlassian.cache.CacheFactory
@Nonnull public <K,V> com.atlassian.cache.Cache<K,V> getCache(@Nonnull String name, com.atlassian.cache.CacheLoader<K,V> loader)
getCache
in interface com.atlassian.cache.CacheFactory
@Nonnull public <K,V> com.atlassian.cache.Cache<K,V> getCache(@Nonnull String name)
getCache
in interface com.atlassian.cache.CacheFactory
@Nonnull public <V> com.atlassian.cache.CachedReference<V> getCachedReference(@Nonnull String name, @Nonnull com.atlassian.cache.Supplier<V> supplier, @Nonnull com.atlassian.cache.CacheSettings required)
getCachedReference
in interface com.atlassian.cache.CacheFactory
@Nonnull public <V> com.atlassian.cache.CachedReference<V> getCachedReference(@Nonnull String name, @Nonnull com.atlassian.cache.Supplier<V> supplier)
getCachedReference
in interface com.atlassian.cache.CacheFactory
@Nonnull public <V> com.atlassian.cache.CachedReference<V> getCachedReference(@Nonnull Class<?> owningClass, @Nonnull String name, @Nonnull com.atlassian.cache.Supplier<V> supplier)
getCachedReference
in interface com.atlassian.cache.CacheFactory
@Nonnull public <V> com.atlassian.cache.CachedReference<V> getCachedReference(@Nonnull Class<?> owningClass, @Nonnull String name, @Nonnull com.atlassian.cache.Supplier<V> supplier, @Nonnull com.atlassian.cache.CacheSettings required)
getCachedReference
in interface com.atlassian.cache.CacheFactory
Copyright © 2003–2015 Atlassian. All rights reserved.