Class CacheManagerTemplate
java.lang.Object
com.atlassian.cache.impl.AbstractCacheManager
com.atlassian.confluence.impl.cache.CacheManagerTemplate
- All Implemented Interfaces:
com.atlassian.cache.CacheFactory
,com.atlassian.cache.CacheManager
,CacheConfigManager
public abstract class CacheManagerTemplate
extends com.atlassian.cache.impl.AbstractCacheManager
implements CacheConfigManager
A partial implementation of
CacheManager
, which tries to smooth over the
implementation horror show that is AbstractCacheManager
, by taking care of the lifecycle concerns
of weakly-referenced ManagedCache
instances.- Since:
- 10.1
-
Field Summary
Fields inherited from class com.atlassian.cache.impl.AbstractCacheManager
cacheCreationLocks, caches, cacheSettingsDefaultsProvider
-
Constructor Summary
ConstructorsConstructorDescriptionCacheManagerTemplate
(com.atlassian.cache.CacheSettingsDefaultsProvider cacheSettingsDefaultsProvider, com.atlassian.cache.impl.metrics.CacheManagerMetricEmitter cacheManagerMetricEmitter) -
Method Summary
Modifier and TypeMethodDescriptionfinal void
changeMaxCacheSize
(String cacheName, int newMaxCacheSize) Changes the max cache size.protected abstract <V> ConfluenceCachedReference
<V> createCachedReferenceInternal
(String name, com.atlassian.cache.Supplier<V> supplier, com.atlassian.cache.CacheSettings settings) protected abstract <K,
V> ConfluenceCache <K, V> createCacheInternal
(String name, com.atlassian.cache.CacheSettings settings, @Nullable com.atlassian.cache.CacheLoader<K, V> loader) protected final <K,
V> com.atlassian.cache.ManagedCache createComputingCache
(String name, com.atlassian.cache.CacheSettings settings, com.atlassian.cache.CacheLoader<K, V> loader) protected final com.atlassian.cache.ManagedCache
createSimpleCache
(String name, com.atlassian.cache.CacheSettings settings) final <V> com.atlassian.cache.CachedReference
<V> getCachedReference
(String name, com.atlassian.cache.Supplier<V> supplier, com.atlassian.cache.CacheSettings settings) final com.atlassian.cache.ManagedCache
getManagedCache
(String cacheName) final Collection
<com.atlassian.cache.ManagedCache> protected final <K,
V> com.atlassian.cache.ManagedCache getOrCreateCache
(String name, com.atlassian.cache.Supplier<ConfluenceCache<K, V>> factory) protected final <V> com.atlassian.cache.ManagedCache
getOrCreateCachedReference
(String name, com.atlassian.cache.Supplier<ConfluenceCachedReference<V>> factory) Methods inherited from class com.atlassian.cache.impl.AbstractCacheManager
flushCaches, getCache, getCache, getCache, getCache, getCache, getCachedReference, getCachedReference, getCachedReference, getCaches, mergeSettings, shutdown
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.cache.CacheFactory
getReadThroughCache, getReadThroughCache
-
Constructor Details
-
CacheManagerTemplate
public CacheManagerTemplate(com.atlassian.cache.CacheSettingsDefaultsProvider cacheSettingsDefaultsProvider, com.atlassian.cache.impl.metrics.CacheManagerMetricEmitter cacheManagerMetricEmitter)
-
-
Method Details
-
createSimpleCache
protected final com.atlassian.cache.ManagedCache createSimpleCache(String name, com.atlassian.cache.CacheSettings settings) - Specified by:
createSimpleCache
in classcom.atlassian.cache.impl.AbstractCacheManager
-
createComputingCache
protected final <K,V> com.atlassian.cache.ManagedCache createComputingCache(String name, com.atlassian.cache.CacheSettings settings, com.atlassian.cache.CacheLoader<K, V> loader) - Specified by:
createComputingCache
in classcom.atlassian.cache.impl.AbstractCacheManager
-
getCachedReference
public final <V> com.atlassian.cache.CachedReference<V> getCachedReference(String name, com.atlassian.cache.Supplier<V> supplier, com.atlassian.cache.CacheSettings settings) - Specified by:
getCachedReference
in interfacecom.atlassian.cache.CacheFactory
-
createCacheInternal
protected abstract <K,V> ConfluenceCache<K,V> createCacheInternal(String name, com.atlassian.cache.CacheSettings settings, @Nullable com.atlassian.cache.CacheLoader<K, V> loader) -
createCachedReferenceInternal
protected abstract <V> ConfluenceCachedReference<V> createCachedReferenceInternal(String name, com.atlassian.cache.Supplier<V> supplier, com.atlassian.cache.CacheSettings settings) -
changeMaxCacheSize
Description copied from interface:CacheConfigManager
Changes the max cache size.- Specified by:
changeMaxCacheSize
in interfaceCacheConfigManager
- Parameters:
cacheName
- cache namenewMaxCacheSize
- new max cache size
-
getManagedCaches
- Specified by:
getManagedCaches
in interfacecom.atlassian.cache.CacheManager
- Overrides:
getManagedCaches
in classcom.atlassian.cache.impl.AbstractCacheManager
-
getOrCreateCache
protected final <K,V> com.atlassian.cache.ManagedCache getOrCreateCache(String name, com.atlassian.cache.Supplier<ConfluenceCache<K, V>> factory) -
getOrCreateCachedReference
protected final <V> com.atlassian.cache.ManagedCache getOrCreateCachedReference(String name, com.atlassian.cache.Supplier<ConfluenceCachedReference<V>> factory) -
getManagedCache
- Specified by:
getManagedCache
in interfacecom.atlassian.cache.CacheManager
- Overrides:
getManagedCache
in classcom.atlassian.cache.impl.AbstractCacheManager
-