|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ro.isdc.wro.util.AbstractDecorator<CacheStrategy<K,V>> ro.isdc.wro.cache.support.CacheStrategyDecorator<K,V> ro.isdc.wro.cache.support.AbstractSynchronizedCacheStrategyDecorator<K,V>
public abstract class AbstractSynchronizedCacheStrategyDecorator<K,V>
Ensure that the 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 Summary | |
---|---|
AbstractSynchronizedCacheStrategyDecorator(CacheStrategy<K,V> decorated)
|
Method Summary | |
---|---|
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. |
Methods inherited from class ro.isdc.wro.cache.support.CacheStrategyDecorator |
---|
clear, destroy |
Methods inherited from class ro.isdc.wro.util.AbstractDecorator |
---|
getDecoratedObject, getOriginalDecoratedObject, getOriginalDecoratedObject, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractSynchronizedCacheStrategyDecorator(CacheStrategy<K,V> decorated)
Method Detail |
---|
public final V get(K key)
get
in interface CacheStrategy<K,V>
get
in class CacheStrategyDecorator<K,V>
key
- Object
protected 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.protected abstract V loadValue(K key)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |