Class CacheAccessImpl
java.lang.Object
de.hybris.platform.regioncache.region.impl.EHCacheRegion
de.hybris.platform.sap.core.bol.cache.impl.CacheAccessImpl
- All Implemented Interfaces:
de.hybris.platform.regioncache.region.CacheRegion,CacheAccess
- Direct Known Subclasses:
MockCacheAccess
public class CacheAccessImpl
extends de.hybris.platform.regioncache.region.impl.EHCacheRegion
implements CacheAccess
Standard cache implementation class.
-
Field Summary
Fields inherited from class de.hybris.platform.regioncache.region.impl.EHCacheRegion
cacheMap, lifecycleCallback, manager, stats -
Constructor Summary
ConstructorsConstructorDescriptionCacheAccessImpl(String name, int maxEntries) Standard constructor.CacheAccessImpl(String name, int maxEntries, String evictionPolicy) Standard constructor.CacheAccessImpl(String name, int maxEntries, String evictionPolicy, boolean exclusiveComputation, boolean statsEnabled) Standard constructor.CacheAccessImpl(String name, int maxEntries, String evictionPolicy, boolean exclusiveComputation, boolean statsEnabled, Long ttlSeconds) Standard constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves all elements from cache.Gets an object from the cache for the given key.getKeys()Provide the keys of all objects, which are currently in the cache region.intReturns number of objects currently stored in the cache.getWithLoader(Object key, de.hybris.platform.regioncache.CacheValueLoader<?> loader) Gets an object from the cache using the loader to get the value.voidPuts an object into the cache region.voidputIfAbsent(Object key, Object object) Puts an object into the cache region, only if no object with same key already exists.voidRemoves an object from the cache.voidsetHandledTypes(String[] handledTypes) Methods inherited from class de.hybris.platform.regioncache.region.impl.EHCacheRegion
containsKey, createCacheConfiguration, createCacheEventListener, createCacheStatistics, destroy, get, getAllKeys, getCacheMaxEntries, getCacheRegionStatistics, getHandledTypes, getMaxReachedSize, getName, getWithLoader, init, invalidate, isStatsEnabled, registerLifecycleCallback, remove, setStatsEnabled, toString, unwrap
-
Constructor Details
-
CacheAccessImpl
Standard constructor.- Parameters:
name- name of the cache regionmaxEntries- maximum number of entries
-
CacheAccessImpl
Standard constructor.- Parameters:
name- name of the cache regionmaxEntries- maximum number of entriesevictionPolicy- eviction policy which is used
-
CacheAccessImpl
public CacheAccessImpl(String name, int maxEntries, String evictionPolicy, boolean exclusiveComputation, boolean statsEnabled) Standard constructor.- Parameters:
name- name of the cache regionmaxEntries- maximum number of entriesevictionPolicy- eviction policy which is usedexclusiveComputation- flag indicating if exclusive computation is usedstatsEnabled- flag indicating if statistics are stored or not
-
CacheAccessImpl
public CacheAccessImpl(String name, int maxEntries, String evictionPolicy, boolean exclusiveComputation, boolean statsEnabled, Long ttlSeconds) Standard constructor.- Parameters:
name- name of the cache regionmaxEntries- maximum number of entriesevictionPolicy- eviction policy which is usedexclusiveComputation- flag indicating if exclusive computation is usedstatsEnabled- flag indicating if statistics are stored or notttlSeconds- time to live of the stored objects in seconds
-
-
Method Details
-
setHandledTypes
- Overrides:
setHandledTypesin classde.hybris.platform.regioncache.region.impl.EHCacheRegion
-
get
Description copied from interface:CacheAccessGets an object from the cache for the given key.- Specified by:
getin interfaceCacheAccess- Parameters:
key- name of object which should be retrieved from the cache- Returns:
- the object or
nullif the object could not be found in the cache
-
getKeys
Description copied from interface:CacheAccessProvide the keys of all objects, which are currently in the cache region.- Specified by:
getKeysin interfaceCacheAccess- Returns:
- all keys.
-
put
Description copied from interface:CacheAccessPuts an object into the cache region.- Specified by:
putin interfaceCacheAccess- Parameters:
key- key of objectobject- object which is put into the cache- Throws:
SAPHybrisCacheException- thrown if something goes wrong while adding an object to cache
-
putIfAbsent
Description copied from interface:CacheAccessPuts an object into the cache region, only if no object with same key already exists.- Specified by:
putIfAbsentin interfaceCacheAccess- Parameters:
key- name of objectobject- object which is put into the cache- Throws:
SAPHybrisCacheException- thrown if something goes wrong while adding an object to cache
-
remove
Description copied from interface:CacheAccessRemoves an object from the cache. The cached object cannot be longer used.- Specified by:
removein interfaceCacheAccess- Parameters:
key- the name of the object which has to be removed from the cache- Throws:
SAPHybrisCacheException- if removing object fails
-
getNumObjects
public int getNumObjects()Description copied from interface:CacheAccessReturns number of objects currently stored in the cache.- Specified by:
getNumObjectsin interfaceCacheAccess- Returns:
- number of objects currently stored in the cache.
-
getWithLoader
Description copied from interface:CacheAccessGets an object from the cache using the loader to get the value.- Specified by:
getWithLoaderin interfaceCacheAccess- Parameters:
key- the name of the object which has to loadedloader- the loader object which is used to load the value- Returns:
- number of objects currently stored in the cache.
-
clearCache
public void clearCache()Description copied from interface:CacheAccessRemoves all elements from cache.- Specified by:
clearCachein interfaceCacheAccess- Specified by:
clearCachein interfacede.hybris.platform.regioncache.region.CacheRegion- Overrides:
clearCachein classde.hybris.platform.regioncache.region.impl.EHCacheRegion
-