Interface ICacheAccess<K,V>

All Superinterfaces:
ICacheAccessManagement
All Known Implementing Classes:
CacheAccess

public interface ICacheAccess<K,V> extends ICacheAccessManagement
ICacheAccess defines the behavior for client access.
  • Method Details

    • get

      V get(K name)
      Basic get method.

      Parameters:
      name -
      Returns:
      Object or null if not found.
    • get

      V get(K name, Supplier<V> supplier)
      Basic get method. If the object cannot be found in the cache, it will be retrieved by calling the supplier and subsequently storing it in the cache.

      Parameters:
      name -
      supplier - supplier to be called if the value is not found
      Returns:
      Object.
    • getMatching

      Map<K,V> getMatching(String pattern)
      Retrieve matching objects from the cache region this instance provides access to.

      Parameters:
      pattern - - a key pattern for the objects stored
      Returns:
      A map of key to values. These are stripped from the wrapper.
    • putSafe

      void putSafe(K name, V obj) throws CacheException
      Puts in cache if an item does not exist with the name in that region.

      Parameters:
      name -
      obj -
      Throws:
      CacheException
    • put

      void put(K name, V obj) throws CacheException
      Puts and/or overrides an element with the name in that region.

      Parameters:
      name -
      obj -
      Throws:
      CacheException
    • put

      void put(K name, V obj, IElementAttributes attr) throws CacheException
      Description of the Method

      Parameters:
      name -
      obj -
      attr -
      Throws:
      CacheException
    • getCacheElement

      This method returns the ICacheElement<K, V> wrapper which provides access to element info and other attributes.

      This returns a reference to the wrapper. Any modifications will be reflected in the cache. No defensive copy is made.

      This method is most useful if you want to determine things such as the how long the element has been in the cache.

      The last access time in the ElementAttributes should be current.

      Parameters:
      name - Key the object is stored as
      Returns:
      The ICacheElement<K, V> if the object is found or null
    • getCacheElements

      Get multiple elements from the cache based on a set of cache keys.

      This method returns the ICacheElement<K, V> wrapper which provides access to element info and other attributes.

      This returns a reference to the wrapper. Any modifications will be reflected in the cache. No defensive copy is made.

      This method is most useful if you want to determine things such as the how long the element has been in the cache.

      The last access time in the ElementAttributes should be current.

      Parameters:
      names - set of Object cache keys
      Returns:
      a map of Object key to ICacheElement<K, V> element, or empty map if none of the keys are present
    • getMatchingCacheElements

      Get multiple elements from the cache based on a set of cache keys.

      This method returns the ICacheElement<K, V> wrapper which provides access to element info and other attributes.

      This returns a reference to the wrapper. Any modifications will be reflected in the cache. No defensive copy is made.

      This method is most useful if you want to determine things such as the how long the element has been in the cache.

      The last access time in the ElementAttributes should be current.

      Parameters:
      pattern - key search pattern
      Returns:
      a map of Object key to ICacheElement<K, V> element, or empty map if no keys match the pattern
    • remove

      void remove(K name) throws CacheException
      Remove an object for this key if one exists, else do nothing.

      Parameters:
      name -
      Throws:
      CacheException
    • resetElementAttributes

      Reset the attributes on the object matching this key name.

      Parameters:
      name -
      attributes -
      Throws:
      CacheException
    • getElementAttributes

      Gets the elementAttributes attribute of the ICacheAccess object

      Parameters:
      name -
      Returns:
      The elementAttributes value
      Throws:
      CacheException