public abstract class AbstractSynchronizedCacheStrategyDecorator<K,V> extends CacheStrategyDecorator<K,V>
loadValue(Object) will be called only once for the same
key. This behavior is important for avoiding redundant execution of expensive computation in concurrent environment
which cause high memory and CPU consumption.| Constructor and Description |
|---|
AbstractSynchronizedCacheStrategyDecorator(CacheStrategy<K,V> decorated) |
| Modifier and Type | Method and Description |
|---|---|
V |
get(K key)
Restore a value from the cache.
|
protected abstract V |
loadValue(K key)
Loads the value associated with the key.
|
protected void |
onBeforeGet(K key)
Invoked just before the get method is invoked.
|
void |
put(K key,
V value)
Put a value in the cache using a key.
|
clear, destroygetDecoratedObject, getOriginalDecoratedObject, getOriginalDecoratedObject, toStringpublic AbstractSynchronizedCacheStrategyDecorator(CacheStrategy<K,V> decorated)
public final V get(K key)
get in interface CacheStrategy<K,V>get in class CacheStrategyDecorator<K,V>key - Objectprotected void onBeforeGet(K key)
public final void put(K key, V value)
put in interface CacheStrategy<K,V>put in class CacheStrategyDecorator<K,V>key - Object.value - Object.Copyright © 2008-2013. All Rights Reserved.