@ParametersAreNonnullByDefault public abstract class AbstractCacheManager extends Object implements CacheManager
CacheManager.| Modifier and Type | Field and Description |
|---|---|
protected com.atlassian.util.concurrent.Function<String,com.atlassian.util.concurrent.ManagedLock> |
cacheCreationLocks
Used to synchronize the creation of caches.
|
protected ConcurrentMap<String,com.atlassian.util.concurrent.Supplier<ManagedCache>> |
caches
Map of all the caches.
|
protected CacheSettingsDefaultsProvider |
cacheSettingsDefaultsProvider |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCacheManager(CacheSettingsDefaultsProvider cacheSettingsDefaultsProvider) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract <K,V> ManagedCache |
createComputingCache(String name,
CacheSettings settings,
CacheLoader<K,V> loader)
Creates a cache that upon a miss is able to populate itself using the loader.
|
protected abstract ManagedCache |
createSimpleCache(String name,
CacheSettings settings)
Creates a cache with no loader, i.e.
|
void |
flushCaches() |
<K,V> Cache<K,V> |
getCache(Class<?> owningClass,
String name) |
<K,V> Cache<K,V> |
getCache(String name) |
<K,V> Cache<K,V> |
getCache(String name,
CacheLoader<K,V> loader) |
<K,V> Cache<K,V> |
getCache(String name,
CacheLoader<K,V> loader,
CacheSettings settings) |
<K,V> Cache<K,V> |
getCache(String name,
Class<K> keyType,
Class<V> valueType) |
<V> CachedReference<V> |
getCachedReference(Class<?> owningClass,
String name,
Supplier<V> supplier) |
<V> CachedReference<V> |
getCachedReference(Class<?> owningClass,
String name,
Supplier<V> supplier,
CacheSettings settings) |
<V> CachedReference<V> |
getCachedReference(String name,
Supplier<V> supplier) |
Collection<Cache<?,?>> |
getCaches() |
ManagedCache |
getManagedCache(String name) |
Collection<ManagedCache> |
getManagedCaches() |
protected CacheSettings |
mergeSettings(String name,
CacheSettings settings) |
void |
shutdown() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCachedReferenceprotected final ConcurrentMap<String,com.atlassian.util.concurrent.Supplier<ManagedCache>> caches
cacheCreationLocks
to ensure that a cache is created only once.protected final com.atlassian.util.concurrent.Function<String,com.atlassian.util.concurrent.ManagedLock> cacheCreationLocks
@Nullable protected final CacheSettingsDefaultsProvider cacheSettingsDefaultsProvider
protected AbstractCacheManager(@Nullable CacheSettingsDefaultsProvider cacheSettingsDefaultsProvider)
@Nonnull public Collection<Cache<?,?>> getCaches()
getCaches in interface CacheManager@Nonnull public Collection<ManagedCache> getManagedCaches()
getManagedCaches in interface CacheManager@Nullable public ManagedCache getManagedCache(@Nonnull String name)
getManagedCache in interface CacheManagerpublic void flushCaches()
flushCaches in interface CacheManager@Nonnull public <K,V> Cache<K,V> getCache(@Nonnull String name)
getCache in interface CacheFactory@Nonnull public <K,V> Cache<K,V> getCache(@Nonnull Class<?> owningClass, @Nonnull String name)
getCache in interface CacheFactory@Nonnull public <K,V> Cache<K,V> getCache(@Nonnull String name, @Nonnull Class<K> keyType, @Nonnull Class<V> valueType)
getCache in interface CacheFactory@Nonnull public <K,V> Cache<K,V> getCache(@Nonnull String name, @Nullable CacheLoader<K,V> loader)
getCache in interface CacheFactory@Nonnull public <V> CachedReference<V> getCachedReference(@Nonnull String name, @Nonnull Supplier<V> supplier)
getCachedReference in interface CacheFactory@Nonnull public <V> CachedReference<V> getCachedReference(@Nonnull Class<?> owningClass, @Nonnull String name, @Nonnull Supplier<V> supplier)
getCachedReference in interface CacheFactory@Nonnull public <V> CachedReference<V> getCachedReference(@Nonnull Class<?> owningClass, @Nonnull String name, @Nonnull Supplier<V> supplier, @Nonnull CacheSettings settings)
getCachedReference in interface CacheFactory@Nonnull public <K,V> Cache<K,V> getCache(@Nonnull String name, @Nullable CacheLoader<K,V> loader, @Nonnull CacheSettings settings)
getCache in interface CacheFactoryprotected abstract <K,V> ManagedCache createComputingCache(@Nonnull String name, @Nonnull CacheSettings settings, @Nullable CacheLoader<K,V> loader)
protected abstract ManagedCache createSimpleCache(@Nonnull String name, @Nonnull CacheSettings settings)
name - the name to give the cache (required)protected CacheSettings mergeSettings(String name, CacheSettings settings)
public void shutdown()
shutdown in interface CacheManagerCopyright © 2018 Atlassian. All rights reserved.