Class BaseIntegrationCache<K extends IntegrationCacheKey,T>

java.lang.Object
de.hybris.platform.integrationservices.cache.impl.BaseIntegrationCache<K,T>
All Implemented Interfaces:
IntegrationCache<K,T>
Direct Known Subclasses:
CsrfParametersCache, DestinationRestTemplateCache, WebhookConvertedItemCache, WebhookDeletedItemCache

public abstract class BaseIntegrationCache<K extends IntegrationCacheKey,T> extends Object implements IntegrationCache<K,T>

Base implementation of the IntegrationCache to be extended for specific generic values.

  • Constructor Details

    • BaseIntegrationCache

      public BaseIntegrationCache()
  • Method Details

    • 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 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)
    • getCache

      protected CacheRegion getCache()
      Retrieves cache regions used by this cache.
      Returns:
      a region injected into this facade.
      See Also:
    • log

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