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 Details

    • DefaultSessionCachedContextProvider

      public DefaultSessionCachedContextProvider()
  • Method Details

    • addItemToSetCache

      public <T> void addItemToSetCache(String cacheKey, T value)
      Description copied from interface: SessionCachedContextProvider
      Add a value to a cached Set.
      Specified by:
      addItemToSetCache in interface SessionCachedContextProvider
      Type Parameters:
      T - type of the value
      Parameters:
      cacheKey - the cache key to find a cached set
      value - the value to add to a cached set
    • getAllItemsFromSetCache

      public <T> Set<T> getAllItemsFromSetCache(String cacheKey)
      Description copied from interface: SessionCachedContextProvider
      Return a cached Set.
      Specified by:
      getAllItemsFromSetCache in interface SessionCachedContextProvider
      Type Parameters:
      T - type of a set element
      Parameters:
      cacheKey - the cache key to find a cached set
      Returns:
      the cached Set.
    • removeItemFromSetCache

      public <T> void removeItemFromSetCache(String cacheKey, T value)
      Description copied from interface: SessionCachedContextProvider
      Remove element from a cached set.
      Specified by:
      removeItemFromSetCache in interface SessionCachedContextProvider
      Type Parameters:
      T - type of the value
      Parameters:
      cacheKey - the cache key to find a cached set
      value - the value to remove from a cached set
    • clearSetCache

      public void clearSetCache(String cacheKey)
      Description copied from interface: SessionCachedContextProvider
      Clear a set cache by its key.
      Specified by:
      clearSetCache in interface SessionCachedContextProvider
      Parameters:
      cacheKey - the cache key
    • addItemToListCache

      public <T> void addItemToListCache(String cacheKey, T value)
      Description copied from interface: SessionCachedContextProvider
      Add a value to a cached List.
      Specified by:
      addItemToListCache in interface SessionCachedContextProvider
      Type Parameters:
      T - type of the value
      Parameters:
      cacheKey - the cache key to find a cached list
      value - the value to add to a cached list
    • createEmptyListCache

      public void createEmptyListCache(String cacheKey)
      Description copied from interface: SessionCachedContextProvider
      Creates an empty cached List.
      Specified by:
      createEmptyListCache in interface SessionCachedContextProvider
      Parameters:
      cacheKey - the cache key
    • getAllItemsFromListCache

      public <T> List<T> getAllItemsFromListCache(String cacheKey)
      Description copied from interface: SessionCachedContextProvider
      Return a cached List.
      Specified by:
      getAllItemsFromListCache in interface SessionCachedContextProvider
      Type Parameters:
      T - type of a list element
      Parameters:
      cacheKey - the cache key to find a cached list
      Returns:
      the cached List.
    • removeItemFromListCache

      public <T> void removeItemFromListCache(String cacheKey, T value)
      Description copied from interface: SessionCachedContextProvider
      Remove element from a cached list.
      Specified by:
      removeItemFromListCache in interface SessionCachedContextProvider
      Type Parameters:
      T - type of the value
      Parameters:
      cacheKey - the cache key to find a cached list
      value - the value to remove from a cached list
    • clearListCache

      public void clearListCache(String cacheKey)
      Description copied from interface: SessionCachedContextProvider
      Clear a list cache by its key.
      Specified by:
      clearListCache in interface SessionCachedContextProvider
      Parameters:
      cacheKey - the cache key
    • addItemToMapCache

      public <K, V> void addItemToMapCache(String cacheKey, K key, V value)
      Description copied from interface: SessionCachedContextProvider
      Add an element to a cached Map
      Specified by:
      addItemToMapCache in interface SessionCachedContextProvider
      Type Parameters:
      K - type of the key
      V - type of the value
      Parameters:
      cacheKey - the cache key to find a cached map
      key - the key for the value
      value - the value
    • getAllItemsFromMapCache

      public <K, V> Map<K,V> getAllItemsFromMapCache(String cacheKey)
      Description copied from interface: SessionCachedContextProvider
      Returns a cached Map
      Specified by:
      getAllItemsFromMapCache in interface SessionCachedContextProvider
      Type Parameters:
      K - type of the key
      V - type of the value
      Parameters:
      cacheKey - the cache key to find a cached map
      Returns:
      the Map
    • removeItemFromMapCache

      public <K> void removeItemFromMapCache(String cacheKey, K key)
      Description copied from interface: SessionCachedContextProvider
      Remove an element from a cached list
      Specified by:
      removeItemFromMapCache in interface SessionCachedContextProvider
      Type Parameters:
      K - type of the key
      Parameters:
      cacheKey - the cache key to find a cached map
      key - the key to remove
    • clearMapCache

      public void clearMapCache(String cacheKey)
      Description copied from interface: SessionCachedContextProvider
      Clear a map cache by its key.
      Specified by:
      clearMapCache in interface SessionCachedContextProvider
      Parameters:
      cacheKey - the cache key
    • hasCacheKey

      public boolean hasCacheKey(String cacheKey)
      Description copied from interface: SessionCachedContextProvider
      Checks if there's a cache with the given key.
      Specified by:
      hasCacheKey in interface SessionCachedContextProvider
      Parameters:
      cacheKey - the cache key
      Returns:
      true if there's a cache with the given key. false otherwise.
    • getOrCreateSetCollectionInCache

      protected <T> T getOrCreateSetCollectionInCache(String cacheKey)
      Get a Set from cache or create an empty Set.
      Type Parameters:
      T - the type of collection
      Parameters:
      cacheKey - the cache key to get or save a cached set
      Returns:
      a Set that is stored in cache
    • getOrCreateListCollectionInCache

      protected <T> T getOrCreateListCollectionInCache(String cacheKey)
      Get a List from cache or create an empty List.
      Type Parameters:
      T - the type of collection
      Parameters:
      cacheKey - the cache key to get or save a cached list
      Returns:
      a List that is stored in cache
    • getOrCreateMapCollectionInCache

      protected <T> T getOrCreateMapCollectionInCache(String cacheKey)
      Get a Map from cache or create an empty Map.
      Type Parameters:
      T - the type of collection
      Parameters:
      cacheKey - the cache key to get or save a cached map
      Returns:
      a Map that is stored in cache
    • getOrCreateCollectionInCache

      protected <T> T getOrCreateCollectionInCache(String cacheKey, Class classType)
      Get a collection from cache or create an empty collection and cache it using the provided cacheKey
      Parameters:
      cacheKey - the cache key to save a cached set
      classType - the Class used to instantiate a new object
      Returns:
      the cached AtomicReference
      Throws:
      InvalidTypeException - when the provided classType fails to be instantiated
    • getWrappedObject

      protected <T> T getWrappedObject(Object rawValue)
      Get the collection object saved in the cache for a given object.
      Parameters:
      rawValue - an AtomicReference object containing the cached value
      Returns:
      the cached value saved in the AtomicReference
      Throws:
      IllegalStateException - when the given rawValue is not of type AtomicReference
    • getSessionService

      protected SessionService getSessionService()
    • setSessionService

      public void setSessionService(SessionService sessionService)