Package be.ehealth.technicalconnector.cache

# Interface Cache<K,V>

All Known Implementing Classes:
  `HashMapCache`, `JSR107Cache`

public interface Cache<K,V>
A cache is similar to a map or a key value store, allowing to retrieve and update values which are associated to keys.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `CACHE_EXPIRY_DURATION`
  `static final String`
  `CACHE_EXPIRY_TYPE`
  `static final String`
  `CACHE_NAME`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  Clear the cache.
  `boolean`
  `containsKey(K key)`
  Returns true, if there is a mapping for the specified key.
  `V`
  `get(K key)`
  Returns a value associated by the given key, that contains a non expired value.
  `String`
  `getName()`
  A configured or generated name of this cache instance.
  `void`
  `put(K key, V value)`
  Updates an existing cache entry for the specified key, so it associates the given value, or, insert a new cache entry for this key and value.
  `void`
  `putAll(Map<K,V> keystores)`
  `void`
  `remove(K key)`
  Removes the mapping for a key from the cache if it is present.

- ## Field Details

  - ### CACHE_NAME

    static final String CACHE_NAME
    See Also:
      - Constant Field Values

  - ### CACHE_EXPIRY_TYPE

    static final String CACHE_EXPIRY_TYPE
    See Also:
      - Constant Field Values

  - ### CACHE_EXPIRY_DURATION

    static final String CACHE_EXPIRY_DURATION
    See Also:
      - Constant Field Values

- ## Method Details

  - ### getName

    String getName()
    A configured or generated name of this cache instance.
    Returns:
      name of this cache or null for anonymous caches.

  - ### get

    V get(K key)
    Returns a value associated by the given key, that contains a non expired value. If no value is present or it is expired the cache loader is invoked, if configured, or `null` is returned.
    Parameters:
      `key` - key with which the specified value is associated
    Returns:
      the value associated with the specified key, or `null` if there was no mapping for the key.

  - ### containsKey

    boolean containsKey(K key)
    Returns true, if there is a mapping for the specified key.
    Parameters:
      `key` - key which association should be checked
    Returns:
      `true`, if this cache contains a mapping for the specified key

  - ### put

    void put(K key, V value)
    Updates an existing cache entry for the specified key, so it associates the given value, or, insert a new cache entry for this key and value.
    Parameters:
      `key` - key with which the specified value is associated
      `value` - value to be associated with the specified key

  - ### remove

    void remove(K key)
    Removes the mapping for a key from the cache if it is present.
    Parameters:
      `key` - key which mapping is to be removed from the cache, not null

  - ### clear

    void clear()
    Clear the cache.

  - ### putAll

    void putAll(Map<K,V> keystores)
    Parameters:
      `keystores` -