Class CacheAccessInactiveImpl
- java.lang.Object
-
- de.hybris.platform.sap.core.bol.cache.impl.CacheAccessInactiveImpl
-
- All Implemented Interfaces:
CacheAccess
public class CacheAccessInactiveImpl extends java.lang.Object implements CacheAccess
Cache implementation class that deactivates the cache implementation such that nothing will be cached.
The cache will always be empty, even when a put-method is called.
-
-
Constructor Summary
Constructors Constructor Description CacheAccessInactiveImpl()Standard constructor.CacheAccessInactiveImpl(java.lang.String name, int maxEntries)Standard constructor.CacheAccessInactiveImpl(java.lang.String name, int maxEntries, java.lang.String evictionPolicy)Standard constructor.CacheAccessInactiveImpl(java.lang.String name, int maxEntries, java.lang.String evictionPolicy, boolean exclusiveComputation, boolean statsEnabled)Standard constructor.CacheAccessInactiveImpl(java.lang.String name, int maxEntries, java.lang.String evictionPolicy, boolean exclusiveComputation, boolean statsEnabled, java.lang.Long ttlSeconds)Standard constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCache()Removes all elements from cache.java.lang.Objectget(java.lang.Object key)Gets an object from the cache for the given key.java.util.Set<java.lang.Object>getKeys()Provide the keys of all objects, which are currently in the cache region.java.util.Map<java.lang.Object,java.lang.Object>getMap()Convenience method to get access to the empty "Cache".intgetNumObjects()Returns number of objects currently stored in the cache.java.lang.ObjectgetWithLoader(java.lang.Object key, CacheValueLoader<?> loader)Gets an object from the cache using the loader to get the value.voidput(java.lang.Object name, java.lang.Object object)Puts an object into the cache region.voidputIfAbsent(java.lang.Object name, java.lang.Object object)Puts an object into the cache region, only if no object with same key already exists.voidremove(java.lang.Object key)Removes an object from the cache.voidsetMap(java.util.Map<java.lang.Object,java.lang.Object> map)Convenience method to set the empty "Cache".
-
-
-
Constructor Detail
-
CacheAccessInactiveImpl
public CacheAccessInactiveImpl(java.lang.String name, int maxEntries)Standard constructor.- Parameters:
name- name of the cache regionmaxEntries- maximum number of entries
-
CacheAccessInactiveImpl
public CacheAccessInactiveImpl(java.lang.String name, int maxEntries, java.lang.String evictionPolicy)Standard constructor.- Parameters:
name- name of the cache regionmaxEntries- maximum number of entriesevictionPolicy- eviction policy which is used
-
CacheAccessInactiveImpl
public CacheAccessInactiveImpl(java.lang.String name, int maxEntries, java.lang.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
-
CacheAccessInactiveImpl
public CacheAccessInactiveImpl(java.lang.String name, int maxEntries, java.lang.String evictionPolicy, boolean exclusiveComputation, boolean statsEnabled, java.lang.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
-
CacheAccessInactiveImpl
public CacheAccessInactiveImpl()
Standard constructor.
-
-
Method Detail
-
getMap
public java.util.Map<java.lang.Object,java.lang.Object> getMap()
Convenience method to get access to the empty "Cache".- Returns:
- cache map
-
setMap
public void setMap(java.util.Map<java.lang.Object,java.lang.Object> map)
Convenience method to set the empty "Cache".- Parameters:
map- cache map
-
get
public java.lang.Object get(java.lang.Object key)
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
public java.util.Set<java.lang.Object> 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.
-
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.
-
put
public void put(java.lang.Object name, java.lang.Object object) throws SAPHybrisCacheExceptionDescription copied from interface:CacheAccessPuts an object into the cache region.- Specified by:
putin interfaceCacheAccess- Parameters:
name- key of objectobject- object which is put into the cache- Throws:
SAPHybrisCacheException- thrown if something goes wrong while adding an object to cache
-
remove
public void remove(java.lang.Object key) throws SAPHybrisCacheExceptionDescription 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
-
putIfAbsent
public void putIfAbsent(java.lang.Object name, java.lang.Object object) throws SAPHybrisCacheExceptionDescription copied from interface:CacheAccessPuts an object into the cache region, only if no object with same key already exists.- Specified by:
putIfAbsentin interfaceCacheAccess- Parameters:
name- name of objectobject- object which is put into the cache- Throws:
SAPHybrisCacheException- thrown if something goes wrong while adding an object to cache
-
getWithLoader
public java.lang.Object getWithLoader(java.lang.Object key, CacheValueLoader<?> loader)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
-
-