Interface LocalCache<K,V>

Type Parameters:
K - the type of the cache Keys used for lookup
V - the type of the cache Values to be stored
All Superinterfaces:
AutoCloseable

public interface LocalCache<K,V> extends AutoCloseable
A LocalCache should be used when a local, non-clustered, cache is required to optimise data access.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Closes all resources associated with the cache.
    get(K key)
    Returns the value associated with the key, or null if there is no cached value for the key.
    void
    Removes the cached value for the specified key.
    void
    put(K key, V value)
    Associates the value with the key in this cache.
  • Method Details

    • get

      V get(K key)
      Returns the value associated with the key, or null if there is no cached value for the key.
      Parameters:
      key - the key whose associated value is to be returned
      Returns:
      the value associated with the specified key or null if no value exists
      Throws:
      NullPointerException - if the specified key is null
    • put

      void put(K key, V value)
      Associates the value with the key in this cache. If the cache previously contained a value associated with the key, the old value is replaced by the new value.
      Parameters:
      key - the key with which the specified value is to be associated
      value - value to be associated with the specified key
      Throws:
      NullPointerException - if the specified key or value is null
    • invalidate

      void invalidate(K key)
      Removes the cached value for the specified key.
      Parameters:
      key - the key whose mapping is to be removed from the cache
      Throws:
      NullPointerException - if the specified key is null
    • close

      void close()
      Closes all resources associated with the cache.
      Specified by:
      close in interface AutoCloseable