Class DefaultSessionCachedContextProvider

    • Constructor Detail

      • DefaultSessionCachedContextProvider

        public DefaultSessionCachedContextProvider()
    • Method Detail

      • addItemToSetCache

        public <T> void addItemToSetCache​(java.lang.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> java.util.Set<T> getAllItemsFromSetCache​(java.lang.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​(java.lang.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
      • addItemToListCache

        public <T> void addItemToListCache​(java.lang.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
      • getAllItemsFromListCache

        public <T> java.util.List<T> getAllItemsFromListCache​(java.lang.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​(java.lang.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
      • addItemToMapCache

        public <K,​V> void addItemToMapCache​(java.lang.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> java.util.Map<K,​V> getAllItemsFromMapCache​(java.lang.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​(java.lang.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
      • hasCacheKey

        public boolean hasCacheKey​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(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
        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​(java.lang.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:
        java.lang.IllegalStateException - when the given rawValue is not of type AtomicReference
      • setSessionService

        public void setSessionService​(SessionService sessionService)