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)
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@Nonnull public V get(@Nonnull K key, @Nonnull com.google.common.base.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–2017 Atlassian. All rights reserved.