Class ProductConfigurationEHCacheAccessImpl<K extends CacheKey,V>
- java.lang.Object
-
- de.hybris.platform.sap.productconfig.runtime.interf.cache.impl.ProductConfigurationEHCacheAccessImpl<K,V>
-
- All Implemented Interfaces:
ProductConfigurationCacheAccess<K,V>
public class ProductConfigurationEHCacheAccessImpl<K extends CacheKey,V> extends java.lang.Object implements ProductConfigurationCacheAccess<K,V>
-
-
Constructor Summary
Constructors Constructor Description ProductConfigurationEHCacheAccessImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCache()Removes all elements from cache.Vget(K key)Gets a value from the cache for the given key.protected EHCacheRegiongetCache()java.util.Set<K>getKeys()Provide the keys of all values, which are currently in the cache region.VgetWithLoader(K key, CacheValueLoader<V> loader)Gets a value from the cache using the loader to get the value.VgetWithSupplier(K key, java.util.function.Supplier<V> supplier)Gets a value from the cache for the given key.voidput(K key, V value)Puts a value into the cache region.voidputIfAbsent(K key, V value)Puts a value into the cache region, only if no value with same key already exists.voidremove(K key)Removes a value from the cache.voidsetCache(EHCacheRegion cache)
-
-
-
Method Detail
-
get
public V get(K key)
Description copied from interface:ProductConfigurationCacheAccessGets a value from the cache for the given key.- Specified by:
getin interfaceProductConfigurationCacheAccess<K extends CacheKey,V>- Parameters:
key- K of object which should be retrieved from the cache- Returns:
- the value or
nullif the value could not be found in the cache
-
getKeys
public java.util.Set<K> getKeys()
Description copied from interface:ProductConfigurationCacheAccessProvide the keys of all values, which are currently in the cache region.- Specified by:
getKeysin interfaceProductConfigurationCacheAccess<K extends CacheKey,V>- Returns:
- all keys.
-
getWithSupplier
public V getWithSupplier(K key, java.util.function.Supplier<V> supplier)
Description copied from interface:ProductConfigurationCacheAccessGets a value from the cache for the given key. If the value is not present in the cache the supplier will be called and the returned value will be cached.- Specified by:
getWithSupplierin interfaceProductConfigurationCacheAccess<K extends CacheKey,V>- Parameters:
key- key of valuesupplier- supplier which returns the value- Returns:
- the value
-
getWithLoader
public V getWithLoader(K key, CacheValueLoader<V> loader)
Description copied from interface:ProductConfigurationCacheAccessGets a value from the cache using the loader to get the value.- Specified by:
getWithLoaderin interfaceProductConfigurationCacheAccess<K extends CacheKey,V>- Parameters:
key- the key of the value which has to loadedloader- the loader object which is used to load the value- Returns:
- number of objects currently stored in the cache.
-
put
public void put(K key, V value)
Description copied from interface:ProductConfigurationCacheAccessPuts a value into the cache region.- Specified by:
putin interfaceProductConfigurationCacheAccess<K extends CacheKey,V>- Parameters:
key- key of valuevalue- value which is put into the cache
-
putIfAbsent
public void putIfAbsent(K key, V value)
Description copied from interface:ProductConfigurationCacheAccessPuts a value into the cache region, only if no value with same key already exists.- Specified by:
putIfAbsentin interfaceProductConfigurationCacheAccess<K extends CacheKey,V>- Parameters:
key- key of valuevalue- value which is put into the cache
-
remove
public void remove(K key)
Description copied from interface:ProductConfigurationCacheAccessRemoves a value from the cache. The cached value cannot be longer used.- Specified by:
removein interfaceProductConfigurationCacheAccess<K extends CacheKey,V>- Parameters:
key- the key of the value which has to be removed from the cache
-
clearCache
public void clearCache()
Description copied from interface:ProductConfigurationCacheAccessRemoves all elements from cache.- Specified by:
clearCachein interfaceProductConfigurationCacheAccess<K extends CacheKey,V>
-
getCache
protected EHCacheRegion getCache()
-
setCache
public void setCache(EHCacheRegion cache)
-
-