Class BaseIntegrationCache<K extends IntegrationCacheKey,T>
- java.lang.Object
-
- de.hybris.platform.integrationservices.cache.impl.BaseIntegrationCache<K,T>
-
- All Implemented Interfaces:
IntegrationCache<K,T>
- Direct Known Subclasses:
CsrfParametersCache,DestinationRestTemplateCache
public abstract class BaseIntegrationCache<K extends IntegrationCacheKey,T> extends java.lang.Object implements IntegrationCache<K,T>
Base implementation of the
IntegrationCacheto be extended for specific generic values.
-
-
Constructor Summary
Constructors Constructor Description BaseIntegrationCache()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancontains(K key)Indicates whether the key exists in the cacheTget(K key)Gets the item from the cache by the keyprotected CacheRegiongetCache()Retrieves cache regions used by this cache.protected abstract java.lang.Class<T>getValueType()Retrieves concrete class of the cached values.protected CacheValueLoaderload(T item)Returns a cache value loader for the specified item.protected org.slf4j.Loggerlog()Returns a logger for writing in to the log.voidput(K key, T item)Puts the item in the cache, referenced by the keyTremove(K key)Removes the item from the cache by the keyvoidsetCacheRegion(CacheRegion region)protected abstract CacheKeytoCacheKey(K key)Converts theIntegrationCacheKeyspecific to the implementation to aCacheKey
-
-
-
Method Detail
-
get
public T get(K key)
Description copied from interface:IntegrationCacheGets the item from the cache by the key- Specified by:
getin interfaceIntegrationCache<K extends IntegrationCacheKey,T>- Parameters:
key- Key to the cached item- Returns:
- The object if the key exists, otherwise null
-
put
public void put(K key, T item)
Description copied from interface:IntegrationCachePuts the item in the cache, referenced by the key- Specified by:
putin interfaceIntegrationCache<K extends IntegrationCacheKey,T>- Parameters:
key- Key to the cached itemitem- Item to cache
-
remove
public T remove(K key)
Description copied from interface:IntegrationCacheRemoves the item from the cache by the key- Specified by:
removein interfaceIntegrationCache<K extends IntegrationCacheKey,T>- Parameters:
key- Key to the item to invalidate- Returns:
- The invalidated item, otherwise null
-
contains
public boolean contains(K key)
Description copied from interface:IntegrationCacheIndicates whether the key exists in the cache- Specified by:
containsin interfaceIntegrationCache<K extends IntegrationCacheKey,T>- Parameters:
key- Key to test for existence- Returns:
- True if the key exists, otherwise false
-
toCacheKey
protected abstract CacheKey toCacheKey(K key)
Converts theIntegrationCacheKeyspecific to the implementation to aCacheKey- Parameters:
key- an integration key to convert- Returns:
- converted cache key
-
getValueType
protected abstract java.lang.Class<T> getValueType()
Retrieves concrete class of the cached values.- Returns:
- class of the values stored in the cache.
-
load
protected CacheValueLoader load(T item)
Returns a cache value loader for the specified item. This implementation simply loads the specified item without any changes or transformations done to it.- Parameters:
item- an item to be placed into the cache.- Returns:
- a loader creating a value to be placed in the cache.
-
setCacheRegion
public void setCacheRegion(CacheRegion region)
-
getCache
protected CacheRegion getCache()
Retrieves cache regions used by this cache.- Returns:
- a region injected into this facade.
- See Also:
setCacheRegion(CacheRegion)
-
log
protected org.slf4j.Logger log()
Returns a logger for writing in to the log.- Returns:
- a logger for writing into the log.
-
-