public class ThreadLocalCacheAccessor<K,V> extends Object
ThreadLocalCache
Modifier and Type | Method and Description |
---|---|
void |
flush()
Flush all thread local cache values.
|
V |
get(K key)
Retrieve a value from the threadlocal cache
|
V |
get(K key,
com.google.common.base.Supplier<V> supplier)
Deprecated.
since 7.0.1. Use
getOrCompute(Object, Supplier) |
V |
getOrCompute(K key,
@NonNull Supplier<V> supplier)
Retrieve a value from the threadlocal cache or from the given supplier.
|
void |
init() |
static <K,V> ThreadLocalCacheAccessor<K,V> |
newInstance()
Factory method (for type inference)
|
void |
put(K key,
V value)
Put a value in the threadlocal cache
|
public static <K,V> ThreadLocalCacheAccessor<K,V> newInstance()
public void put(K key, V value)
key
- the key to cachevalue
- the value to cachepublic V get(K key)
key
- the key for the cache value@Deprecated public V get(K key, com.google.common.base.Supplier<V> supplier)
getOrCompute(Object, Supplier)
key
- the key for the cache valuesupplier
- supplier that can produce the value if neededpublic V getOrCompute(K key, @NonNull Supplier<V> supplier)
key
- the key for the cache valuesupplier
- supplier that can produce the value if neededpublic void init()
public void flush()
Copyright © 2003–2019 Atlassian. All rights reserved.