Class BaseIntegrationCache<K extends IntegrationCacheKey,​T>

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(K key)
      Indicates whether the key exists in the cache
      T get​(K key)
      Gets the item from the cache by the key
      protected CacheRegion getCache()
      Retrieves cache regions used by this cache.
      protected abstract java.lang.Class<T> getValueType()
      Retrieves concrete class of the cached values.
      protected CacheValueLoader load​(T item)
      Returns a cache value loader for the specified item.
      protected org.slf4j.Logger log()
      Returns a logger for writing in to the log.
      void put​(K key, T item)
      Puts the item in the cache, referenced by the key
      T remove​(K key)
      Removes the item from the cache by the key
      void setCacheRegion​(CacheRegion region)  
      protected abstract CacheKey toCacheKey​(K key)
      Converts the IntegrationCacheKey specific to the implementation to a CacheKey
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BaseIntegrationCache

        public BaseIntegrationCache()
    • Method Detail

      • get

        public T get​(K key)
        Description copied from interface: IntegrationCache
        Gets the item from the cache by the key
        Specified by:
        get in interface IntegrationCache<K extends IntegrationCacheKey,​T>
        Parameters:
        key - Key to the cached item
        Returns:
        The object if the key exists, otherwise null
      • put

        public void put​(K key,
                        T item)
        Description copied from interface: IntegrationCache
        Puts the item in the cache, referenced by the key
        Specified by:
        put in interface IntegrationCache<K extends IntegrationCacheKey,​T>
        Parameters:
        key - Key to the cached item
        item - Item to cache
      • remove

        public T remove​(K key)
        Description copied from interface: IntegrationCache
        Removes the item from the cache by the key
        Specified by:
        remove in interface IntegrationCache<K extends IntegrationCacheKey,​T>
        Parameters:
        key - Key to the item to invalidate
        Returns:
        The invalidated item, otherwise null
      • contains

        public boolean contains​(K key)
        Description copied from interface: IntegrationCache
        Indicates whether the key exists in the cache
        Specified by:
        contains in interface IntegrationCache<K extends IntegrationCacheKey,​T>
        Parameters:
        key - Key to test for existence
        Returns:
        True if the key exists, otherwise false
      • toCacheKey

        protected abstract CacheKey toCacheKey​(K key)
        Converts the IntegrationCacheKey specific to the implementation to a CacheKey
        Parameters:
        key - an integration key to convert
        Returns:
        converted cache key
      • getValueType

        protected abstract java.lang.Class<T> getValueType()
        Retrieves concrete class of the cached values.
        Returns:
        class of the values stored in the cache.
      • load

        protected CacheValueLoader load​(T item)
        Returns a cache value loader for the specified item. This implementation simply loads the specified item without any changes or transformations done to it.
        Parameters:
        item - an item to be placed into the cache.
        Returns:
        a loader creating a value to be placed in the cache.
      • setCacheRegion

        public void setCacheRegion​(CacheRegion region)
      • log

        protected org.slf4j.Logger log()
        Returns a logger for writing in to the log.
        Returns:
        a logger for writing into the log.