public class ThreadLocalCacheAccessor<K,V> extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
dispose()
Dispose WorkContext local cache
|
static void |
flush()
Flush all WorkContext local cache values.
|
V |
get(K key)
Retrieve a value from the WorkContext local cache
|
V |
get(K key,
com.google.common.base.Supplier<V> supplier)
Retrieve a value from the WorkContext local cache or from the given supplier.
|
static void |
init()
Init WorkContext local cache
|
static <K,V> ThreadLocalCacheAccessor<K,V> |
newInstance()
Factory method (for type inference)
|
void |
put(K key,
V value)
Put a value in the WorkContext local 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 static void init()
public static void flush()
public static void dispose()
Copyright © 2003–2017 Atlassian. All rights reserved.