Package com.hybris.cockpitng.util.cache
Class WidgetAsyncWarmUpCache<K,V>
- java.lang.Object
-
- com.hybris.cockpitng.util.cache.WidgetAsyncWarmUpCache<K,V>
-
- All Implemented Interfaces:
AsyncWarmUpCache<K,V>
public class WidgetAsyncWarmUpCache<K,V> extends java.lang.Object implements AsyncWarmUpCache<K,V>
A asynchronous warm up cache that is bound to particular widget instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classWidgetAsyncWarmUpCache.WarmUpOperation
-
Constructor Summary
Constructors Constructor Description WidgetAsyncWarmUpCache(WidgetInstanceManager wim)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcancelRunningWarmingUp()voidclear()Clears whole cache.protected WidgetAsyncWarmUpCache.WarmUpOperationcreateOperation(java.util.Iterator<java.util.Collection<K>> keys, java.util.function.Function<K,V> values)Vget(K key)Gets cached value for specified key.Vget(K key, java.util.function.Supplier<V> defaultValue)Gets cached value for specified key.protected org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>getCallbackEvent()protected WidgetInstanceManagergetWidgetInstanceManager()booleanhas(K key)Checks whether a value for specified key is cached.protected voidregisterWarmingUpOperation(WidgetAsyncWarmUpCache.WarmUpOperation operation)voidrevoke(K key)Removes a value cached for specified key.voidsetCallbackEvent(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent)protected voidunregisterWarmingUpOperation(WidgetAsyncWarmUpCache.WarmUpOperation operation)voidwarmUp(java.util.Iterator<java.util.Collection<K>> keys, java.util.function.Function<K,V> values)Triggers asynchronous cache warm up.
-
-
-
Constructor Detail
-
WidgetAsyncWarmUpCache
public WidgetAsyncWarmUpCache(WidgetInstanceManager wim)
-
-
Method Detail
-
getCallbackEvent
protected org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> getCallbackEvent()
-
setCallbackEvent
public void setCallbackEvent(org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> callbackEvent)
-
getWidgetInstanceManager
protected WidgetInstanceManager getWidgetInstanceManager()
-
warmUp
public void warmUp(java.util.Iterator<java.util.Collection<K>> keys, java.util.function.Function<K,V> values)
Description copied from interface:AsyncWarmUpCacheTriggers asynchronous cache warm up.- Specified by:
warmUpin interfaceAsyncWarmUpCache<K,V>- Parameters:
keys- iterator over keys to be processedvalues- value provider
-
createOperation
protected WidgetAsyncWarmUpCache.WarmUpOperation createOperation(java.util.Iterator<java.util.Collection<K>> keys, java.util.function.Function<K,V> values)
-
has
public boolean has(K key)
Description copied from interface:AsyncWarmUpCacheChecks whether a value for specified key is cached.- Specified by:
hasin interfaceAsyncWarmUpCache<K,V>- Parameters:
key- value key- Returns:
trueif value is cached
-
get
public V get(K key)
Description copied from interface:AsyncWarmUpCacheGets cached value for specified key.- Specified by:
getin interfaceAsyncWarmUpCache<K,V>- Parameters:
key- value key- Returns:
- value for key
-
get
public V get(K key, java.util.function.Supplier<V> defaultValue)
Description copied from interface:AsyncWarmUpCacheGets cached value for specified key. If cache has no value for specified key, default value provider is asked for it.- Specified by:
getin interfaceAsyncWarmUpCache<K,V>- Parameters:
key- value keydefaultValue- a supplier for a result in case value is not cached- Returns:
- value for key
-
revoke
public void revoke(K key)
Description copied from interface:AsyncWarmUpCacheRemoves a value cached for specified key.- Specified by:
revokein interfaceAsyncWarmUpCache<K,V>- Parameters:
key- value key
-
clear
public void clear()
Description copied from interface:AsyncWarmUpCacheClears whole cache.- Specified by:
clearin interfaceAsyncWarmUpCache<K,V>
-
registerWarmingUpOperation
protected void registerWarmingUpOperation(WidgetAsyncWarmUpCache.WarmUpOperation operation)
-
unregisterWarmingUpOperation
protected void unregisterWarmingUpOperation(WidgetAsyncWarmUpCache.WarmUpOperation operation)
-
cancelRunningWarmingUp
protected void cancelRunningWarmingUp()
-
-