Class DefaultCacheAccessService<K extends de.hybris.platform.regioncache.key.CacheKey,V>
java.lang.Object
de.hybris.platform.cpq.productconfig.services.impl.DefaultCacheAccessService<K,V>
- Type Parameters:
K- keyV- value
- All Implemented Interfaces:
CacheAccessService<K,V>
public class DefaultCacheAccessService<K extends de.hybris.platform.regioncache.key.CacheKey,V>
extends Object
implements CacheAccessService<K,V>
Default implementation of
CacheAccessService which provides direct access to a cache region.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultCacheAccessService(de.hybris.platform.regioncache.region.impl.EHCacheRegion cache) Default constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves all elements from cache.Gets a value from the cache for the given key.protected de.hybris.platform.regioncache.region.impl.EHCacheRegiongetCache()getKeys()Provide the keys of all values, which are currently in the cache region.getWithLoader(K key, de.hybris.platform.regioncache.CacheValueLoader<V> loader) Gets a value from the cache using the loader to get the value.getWithSupplier(K key, Supplier<V> supplier) Gets a value from the cache for the given key.voidPuts 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.voidRemoves a value from the cache.
-
Constructor Details
-
DefaultCacheAccessService
public DefaultCacheAccessService(de.hybris.platform.regioncache.region.impl.EHCacheRegion cache) Default constructor- Parameters:
cache- cache region
-
-
Method Details
-
get
Description copied from interface:CacheAccessServiceGets a value from the cache for the given key.- Specified by:
getin interfaceCacheAccessService<K extends de.hybris.platform.regioncache.key.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
Description copied from interface:CacheAccessServiceProvide the keys of all values, which are currently in the cache region.- Specified by:
getKeysin interfaceCacheAccessService<K extends de.hybris.platform.regioncache.key.CacheKey,V> - Returns:
- all keys.
-
getWithSupplier
Description copied from interface:CacheAccessServiceGets 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 interfaceCacheAccessService<K extends de.hybris.platform.regioncache.key.CacheKey,V> - Parameters:
key- key of valuesupplier- supplier which returns the value- Returns:
- the value
-
getWithLoader
Description copied from interface:CacheAccessServiceGets a value from the cache using the loader to get the value.- Specified by:
getWithLoaderin interfaceCacheAccessService<K extends de.hybris.platform.regioncache.key.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
Description copied from interface:CacheAccessServicePuts a value into the cache region.- Specified by:
putin interfaceCacheAccessService<K extends de.hybris.platform.regioncache.key.CacheKey,V> - Parameters:
key- key of valuevalue- value which is put into the cache
-
putIfAbsent
Description copied from interface:CacheAccessServicePuts a value into the cache region, only if no value with same key already exists.- Specified by:
putIfAbsentin interfaceCacheAccessService<K extends de.hybris.platform.regioncache.key.CacheKey,V> - Parameters:
key- key of valuevalue- value which is put into the cache
-
remove
Description copied from interface:CacheAccessServiceRemoves a value from the cache. The cached value cannot be longer used.- Specified by:
removein interfaceCacheAccessService<K extends de.hybris.platform.regioncache.key.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:CacheAccessServiceRemoves all elements from cache.- Specified by:
clearCachein interfaceCacheAccessService<K extends de.hybris.platform.regioncache.key.CacheKey,V>
-
getCache
protected de.hybris.platform.regioncache.region.impl.EHCacheRegion getCache()
-