Class DefaultSessionCachedContextProvider
java.lang.Object
de.hybris.platform.cms2.common.service.impl.DefaultSessionCachedContextProvider
- All Implemented Interfaces:
SessionCachedContextProvider
public class DefaultSessionCachedContextProvider
extends Object
implements SessionCachedContextProvider
Default implementation of
SessionCachedContextProvider-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> voidaddItemToListCache(String cacheKey, T value) Add a value to a cachedList.<K,V> void addItemToMapCache(String cacheKey, K key, V value) Add an element to a cachedMap<T> voidaddItemToSetCache(String cacheKey, T value) Add a value to a cachedSet.voidclearListCache(String cacheKey) Clear a list cache by its key.voidclearMapCache(String cacheKey) Clear a map cache by its key.voidclearSetCache(String cacheKey) Clear a set cache by its key.voidcreateEmptyListCache(String cacheKey) Creates an empty cachedList.<T> List<T>getAllItemsFromListCache(String cacheKey) Return a cachedList.<K,V> Map<K, V> getAllItemsFromMapCache(String cacheKey) Returns a cachedMap<T> Set<T>getAllItemsFromSetCache(String cacheKey) Return a cachedSet.protected <T> TgetOrCreateCollectionInCache(String cacheKey, Class classType) Get a collection from cache or create an empty collection and cache it using the providedcacheKeyprotected <T> TgetOrCreateListCollectionInCache(String cacheKey) protected <T> TgetOrCreateMapCollectionInCache(String cacheKey) protected <T> TgetOrCreateSetCollectionInCache(String cacheKey) protected SessionServiceprotected <T> TgetWrappedObject(Object rawValue) Get the collection object saved in the cache for a given object.booleanhasCacheKey(String cacheKey) Checks if there's a cache with the given key.<T> voidremoveItemFromListCache(String cacheKey, T value) Remove element from a cached list.<K> voidremoveItemFromMapCache(String cacheKey, K key) Remove an element from a cached list<T> voidremoveItemFromSetCache(String cacheKey, T value) Remove element from a cached set.voidsetSessionService(SessionService sessionService)
-
Constructor Details
-
DefaultSessionCachedContextProvider
public DefaultSessionCachedContextProvider()
-
-
Method Details
-
addItemToSetCache
Description copied from interface:SessionCachedContextProviderAdd a value to a cachedSet.- Specified by:
addItemToSetCachein interfaceSessionCachedContextProvider- Type Parameters:
T- type of the value- Parameters:
cacheKey- the cache key to find a cached setvalue- the value to add to a cached set
-
getAllItemsFromSetCache
Description copied from interface:SessionCachedContextProviderReturn a cachedSet.- Specified by:
getAllItemsFromSetCachein interfaceSessionCachedContextProvider- Type Parameters:
T- type of a set element- Parameters:
cacheKey- the cache key to find a cached set- Returns:
- the cached
Set.
-
removeItemFromSetCache
Description copied from interface:SessionCachedContextProviderRemove element from a cached set.- Specified by:
removeItemFromSetCachein interfaceSessionCachedContextProvider- Type Parameters:
T- type of the value- Parameters:
cacheKey- the cache key to find a cached setvalue- the value to remove from a cached set
-
clearSetCache
Description copied from interface:SessionCachedContextProviderClear a set cache by its key.- Specified by:
clearSetCachein interfaceSessionCachedContextProvider- Parameters:
cacheKey- the cache key
-
addItemToListCache
Description copied from interface:SessionCachedContextProviderAdd a value to a cachedList.- Specified by:
addItemToListCachein interfaceSessionCachedContextProvider- Type Parameters:
T- type of the value- Parameters:
cacheKey- the cache key to find a cached listvalue- the value to add to a cached list
-
createEmptyListCache
Description copied from interface:SessionCachedContextProviderCreates an empty cachedList.- Specified by:
createEmptyListCachein interfaceSessionCachedContextProvider- Parameters:
cacheKey- the cache key
-
getAllItemsFromListCache
Description copied from interface:SessionCachedContextProviderReturn a cachedList.- Specified by:
getAllItemsFromListCachein interfaceSessionCachedContextProvider- Type Parameters:
T- type of a list element- Parameters:
cacheKey- the cache key to find a cached list- Returns:
- the cached
List.
-
removeItemFromListCache
Description copied from interface:SessionCachedContextProviderRemove element from a cached list.- Specified by:
removeItemFromListCachein interfaceSessionCachedContextProvider- Type Parameters:
T- type of the value- Parameters:
cacheKey- the cache key to find a cached listvalue- the value to remove from a cached list
-
clearListCache
Description copied from interface:SessionCachedContextProviderClear a list cache by its key.- Specified by:
clearListCachein interfaceSessionCachedContextProvider- Parameters:
cacheKey- the cache key
-
addItemToMapCache
Description copied from interface:SessionCachedContextProviderAdd an element to a cachedMap- Specified by:
addItemToMapCachein interfaceSessionCachedContextProvider- Type Parameters:
K- type of the keyV- type of the value- Parameters:
cacheKey- the cache key to find a cached mapkey- the key for the valuevalue- the value
-
getAllItemsFromMapCache
Description copied from interface:SessionCachedContextProviderReturns a cachedMap- Specified by:
getAllItemsFromMapCachein interfaceSessionCachedContextProvider- Type Parameters:
K- type of the keyV- type of the value- Parameters:
cacheKey- the cache key to find a cached map- Returns:
- the
Map
-
removeItemFromMapCache
Description copied from interface:SessionCachedContextProviderRemove an element from a cached list- Specified by:
removeItemFromMapCachein interfaceSessionCachedContextProvider- Type Parameters:
K- type of the key- Parameters:
cacheKey- the cache key to find a cached mapkey- the key to remove
-
clearMapCache
Description copied from interface:SessionCachedContextProviderClear a map cache by its key.- Specified by:
clearMapCachein interfaceSessionCachedContextProvider- Parameters:
cacheKey- the cache key
-
hasCacheKey
Description copied from interface:SessionCachedContextProviderChecks if there's a cache with the given key.- Specified by:
hasCacheKeyin interfaceSessionCachedContextProvider- Parameters:
cacheKey- the cache key- Returns:
- true if there's a cache with the given key. false otherwise.
-
getOrCreateSetCollectionInCache
- Type Parameters:
T- the type of collection- Parameters:
cacheKey- the cache key to get or save a cached set- Returns:
- a
Setthat is stored in cache
-
getOrCreateListCollectionInCache
- Type Parameters:
T- the type of collection- Parameters:
cacheKey- the cache key to get or save a cached list- Returns:
- a
Listthat is stored in cache
-
getOrCreateMapCollectionInCache
- Type Parameters:
T- the type of collection- Parameters:
cacheKey- the cache key to get or save a cached map- Returns:
- a
Mapthat is stored in cache
-
getOrCreateCollectionInCache
Get a collection from cache or create an empty collection and cache it using the providedcacheKey- Parameters:
cacheKey- the cache key to save a cached setclassType- theClassused to instantiate a new object- Returns:
- the cached
AtomicReference - Throws:
InvalidTypeException- when the providedclassTypefails to be instantiated
-
getWrappedObject
Get the collection object saved in the cache for a given object.- Parameters:
rawValue- anAtomicReferenceobject containing the cached value- Returns:
- the cached value saved in the
AtomicReference - Throws:
IllegalStateException- when the givenrawValueis not of typeAtomicReference
-
getSessionService
-
setSessionService
-