@ParametersAreNonnullByDefault public interface SingleValueLocalCache<V>
| Modifier and Type | Method and Description |
|---|---|
V |
get()
Gets a cached value or creates new one (using the supplier) and puts it into the cache if value does not exist.
|
static <V> SingleValueLocalCache<V> |
of(com.atlassian.cache.CachedReference<V> cache)
Creates single value cache wrapper over
CachedReference. |
static <V> SingleValueLocalCache<V> |
of(com.atlassian.vcache.LocalCacheOperations<String,V> cache,
java.util.function.Supplier<V> supplier)
Creates single value cache wrapper over
LocalCacheOperations. |
void |
reset()
Removes a cached value from the cache if it is cached.
|
static final String KEY
@Nonnull V get()
void reset()
static <V> SingleValueLocalCache<V> of(com.atlassian.vcache.LocalCacheOperations<String,V> cache, java.util.function.Supplier<V> supplier)
LocalCacheOperations.cache - that would used as a backend. It should not be used directly by anything else.supplier - used to generate the value, if one does not exist already for the key. The supplier may not
return null.SingleValueLocalCache backed by a supplied cache.static <V> SingleValueLocalCache<V> of(com.atlassian.cache.CachedReference<V> cache)
CachedReference.
This method is only here to make it easy to test the performance impacts of converting a CachedReference by
using a dark feature flag.
This method WILL be removed once all atlassian caches have been replaced with vcache caches.
cache - that would used as a backend. It should not be used directly by anything else.SingleValueLocalCache backed by a supplied cache.Copyright © 2002-2016 Atlassian. All Rights Reserved.