public class DefaultSessionCachedContextProvider extends java.lang.Object implements SessionCachedContextProvider
SessionCachedContextProvider| Constructor and Description |
|---|
DefaultSessionCachedContextProvider() |
| Modifier and Type | Method and Description |
|---|---|
<T> void |
addItemToListCache(java.lang.String cacheKey,
T value)
Add a value to a cached
List. |
<K,V> void |
addItemToMapCache(java.lang.String cacheKey,
K key,
V value)
Add an element to a cached
Map |
<T> void |
addItemToSetCache(java.lang.String cacheKey,
T value)
Add a value to a cached
Set. |
void |
clearListCache(java.lang.String cacheKey)
Clear a list cache by its key.
|
void |
clearMapCache(java.lang.String cacheKey)
Clear a map cache by its key.
|
void |
clearSetCache(java.lang.String cacheKey)
Clear a set cache by its key.
|
void |
createEmptyListCache(java.lang.String cacheKey)
Creates an empty cached
List. |
<T> java.util.List<T> |
getAllItemsFromListCache(java.lang.String cacheKey)
Return a cached
List. |
<K,V> java.util.Map<K,V> |
getAllItemsFromMapCache(java.lang.String cacheKey)
Returns a cached
Map |
<T> java.util.Set<T> |
getAllItemsFromSetCache(java.lang.String cacheKey)
Return a cached
Set. |
protected <T> T |
getOrCreateCollectionInCache(java.lang.String cacheKey,
java.lang.Class classType)
Get a collection from cache or create an empty collection and cache it using the provided
cacheKey |
protected <T> T |
getOrCreateListCollectionInCache(java.lang.String cacheKey)
Get a
List from cache or create an empty List. |
protected <T> T |
getOrCreateMapCollectionInCache(java.lang.String cacheKey)
Get a
Map from cache or create an empty Map. |
protected <T> T |
getOrCreateSetCollectionInCache(java.lang.String cacheKey)
Get a
Set from cache or create an empty Set. |
protected SessionService |
getSessionService() |
protected <T> T |
getWrappedObject(java.lang.Object rawValue)
Get the collection object saved in the cache for a given object.
|
boolean |
hasCacheKey(java.lang.String cacheKey)
Checks if there's a cache with the given key.
|
<T> void |
removeItemFromListCache(java.lang.String cacheKey,
T value)
Remove element from a cached list.
|
<K> void |
removeItemFromMapCache(java.lang.String cacheKey,
K key)
Remove an element from a cached list
|
<T> void |
removeItemFromSetCache(java.lang.String cacheKey,
T value)
Remove element from a cached set.
|
void |
setSessionService(SessionService sessionService) |
public <T> void addItemToSetCache(java.lang.String cacheKey,
T value)
SessionCachedContextProviderSet.addItemToSetCache in interface SessionCachedContextProviderT - type of the valuecacheKey - the cache key to find a cached setvalue - the value to add to a cached setpublic <T> java.util.Set<T> getAllItemsFromSetCache(java.lang.String cacheKey)
SessionCachedContextProviderSet.getAllItemsFromSetCache in interface SessionCachedContextProviderT - type of a set elementcacheKey - the cache key to find a cached setSet.public <T> void removeItemFromSetCache(java.lang.String cacheKey,
T value)
SessionCachedContextProviderremoveItemFromSetCache in interface SessionCachedContextProviderT - type of the valuecacheKey - the cache key to find a cached setvalue - the value to remove from a cached setpublic void clearSetCache(java.lang.String cacheKey)
SessionCachedContextProviderclearSetCache in interface SessionCachedContextProvidercacheKey - the cache keypublic <T> void addItemToListCache(java.lang.String cacheKey,
T value)
SessionCachedContextProviderList.addItemToListCache in interface SessionCachedContextProviderT - type of the valuecacheKey - the cache key to find a cached listvalue - the value to add to a cached listpublic void createEmptyListCache(java.lang.String cacheKey)
SessionCachedContextProviderList.createEmptyListCache in interface SessionCachedContextProvidercacheKey - the cache keypublic <T> java.util.List<T> getAllItemsFromListCache(java.lang.String cacheKey)
SessionCachedContextProviderList.getAllItemsFromListCache in interface SessionCachedContextProviderT - type of a list elementcacheKey - the cache key to find a cached listList.public <T> void removeItemFromListCache(java.lang.String cacheKey,
T value)
SessionCachedContextProviderremoveItemFromListCache in interface SessionCachedContextProviderT - type of the valuecacheKey - the cache key to find a cached listvalue - the value to remove from a cached listpublic void clearListCache(java.lang.String cacheKey)
SessionCachedContextProviderclearListCache in interface SessionCachedContextProvidercacheKey - the cache keypublic <K,V> void addItemToMapCache(java.lang.String cacheKey,
K key,
V value)
SessionCachedContextProviderMapaddItemToMapCache in interface SessionCachedContextProviderK - type of the keyV - type of the valuecacheKey - the cache key to find a cached mapkey - the key for the valuevalue - the valuepublic <K,V> java.util.Map<K,V> getAllItemsFromMapCache(java.lang.String cacheKey)
SessionCachedContextProviderMapgetAllItemsFromMapCache in interface SessionCachedContextProviderK - type of the keyV - type of the valuecacheKey - the cache key to find a cached mapMappublic <K> void removeItemFromMapCache(java.lang.String cacheKey,
K key)
SessionCachedContextProviderremoveItemFromMapCache in interface SessionCachedContextProviderK - type of the keycacheKey - the cache key to find a cached mapkey - the key to removepublic void clearMapCache(java.lang.String cacheKey)
SessionCachedContextProviderclearMapCache in interface SessionCachedContextProvidercacheKey - the cache keypublic boolean hasCacheKey(java.lang.String cacheKey)
SessionCachedContextProviderhasCacheKey in interface SessionCachedContextProvidercacheKey - the cache keyprotected <T> T getOrCreateSetCollectionInCache(java.lang.String cacheKey)
Set from cache or create an empty Set.T - the type of collectioncacheKey - the cache key to get or save a cached setSet that is stored in cacheprotected <T> T getOrCreateListCollectionInCache(java.lang.String cacheKey)
List from cache or create an empty List.T - the type of collectioncacheKey - the cache key to get or save a cached listList that is stored in cacheprotected <T> T getOrCreateMapCollectionInCache(java.lang.String cacheKey)
Map from cache or create an empty Map.T - the type of collectioncacheKey - the cache key to get or save a cached mapMap that is stored in cacheprotected <T> T getOrCreateCollectionInCache(java.lang.String cacheKey,
java.lang.Class classType)
cacheKeycacheKey - the cache key to save a cached setclassType - the Class used to instantiate a new objectAtomicReferenceInvalidTypeException - when the provided classType fails to be instantiatedprotected <T> T getWrappedObject(java.lang.Object rawValue)
rawValue - an AtomicReference object containing the cached valueAtomicReferencejava.lang.IllegalStateException - when the given rawValue is not of type AtomicReferenceprotected SessionService getSessionService()
public void setSessionService(SessionService sessionService)
Copyright © 2018 SAP SE. All Rights Reserved.