Interface ProductConfigurationCacheAccess<K,​V>

  • All Known Implementing Classes:
    ProductConfigurationEHCacheAccessImpl

    public interface ProductConfigurationCacheAccess<K,​V>
    The ProductConfigurationCacheAccess provides the direct access to a cache region.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clearCache()
      Removes all elements from cache.
      V get​(K key)
      Gets a value from the cache for the given key.
      java.util.Set<K> getKeys()
      Provide the keys of all values, which are currently in the cache region.
      V getWithLoader​(K key, CacheValueLoader<V> loader)
      Gets a value from the cache using the loader to get the value.
      V getWithSupplier​(K key, java.util.function.Supplier<V> supplier)
      Gets a value from the cache for the given key.
      void put​(K key, V value)
      Puts a value into the cache region.
      void putIfAbsent​(K key, V value)
      Puts a value into the cache region, only if no value with same key already exists.
      void remove​(K key)
      Removes a value from the cache.
    • Method Detail

      • get

        V get​(K key)
        Gets a value from the cache for the given key.
        Parameters:
        key - K of object which should be retrieved from the cache
        Returns:
        the value or null if the value could not be found in the cache
      • getKeys

        java.util.Set<K> getKeys()
        Provide the keys of all values, which are currently in the cache region.
        Returns:
        all keys.
      • getWithSupplier

        V getWithSupplier​(K key,
                          java.util.function.Supplier<V> supplier)
        Gets a value from the cache for the given key. If the value is not present in the cache the supplier will be called and the returned value will be cached.
        Parameters:
        key - key of value
        supplier - supplier which returns the value
        Returns:
        the value
      • put

        void put​(K key,
                 V value)
        Puts a value into the cache region.
        Parameters:
        key - key of value
        value - value which is put into the cache
      • putIfAbsent

        void putIfAbsent​(K key,
                         V value)
        Puts a value into the cache region, only if no value with same key already exists.
        Parameters:
        key - key of value
        value - value which is put into the cache
      • remove

        void remove​(K key)
        Removes a value from the cache. The cached value cannot be longer used.
        Parameters:
        key - the key of the value which has to be removed from the cache
      • getWithLoader

        V getWithLoader​(K key,
                        CacheValueLoader<V> loader)
        Gets a value from the cache using the loader to get the value.
        Parameters:
        key - the key of the value which has to loaded
        loader - the loader object which is used to load the value
        Returns:
        number of objects currently stored in the cache.
      • clearCache

        void clearCache()
        Removes all elements from cache.