Package be.ehealth.technicalconnector.cache.impl

# Class JSR107Cache<K,V>

java.lang.Object
be.ehealth.technicalconnector.cache.impl.JSR107Cache<K,V>

All Implemented Interfaces:
  `Cache<K,V>`, `ShutdownHook`, `ConfigurableImplementation`

public class JSR107Cache<K,V> extends Object implements Cache<K,V>, ConfigurableImplementation, ShutdownHook

- ## Field Summary

  ### Fields inherited from interface be.ehealth.technicalconnector.cache.Cache

  `CACHE_EXPIRY_DURATION, CACHE_EXPIRY_TYPE, CACHE_NAME`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JSR107Cache()`

- ## 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`
  `initialize(Map<String,Object> parameterMap)`
  initializes the implementation with additional parameters.
  `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> map)`
  `void`
  `remove(K key)`
  Removes the mapping for a key from the cache if it is present.
  `void`
  `shutdown()`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### JSR107Cache

    public JSR107Cache()

- ## Method Details

  - ### initialize

    public void initialize(Map<String,Object> parameterMap) throws TechnicalConnectorException
    Description copied from interface: `ConfigurableImplementation`
    initializes the implementation with additional parameters.
    Specified by:
      `initialize` in interface `ConfigurableImplementation`
    Parameters:
      `parameterMap` - Map with for each propertyString ,the input parameter as Object.
    Throws:
      `TechnicalConnectorException` - if the parameterMap is not correct.

  - ### getName

    public String getName()
    Description copied from interface: `Cache`
    A configured or generated name of this cache instance.
    Specified by:
      `getName` in interface `Cache<K,V>`
    Returns:
      name of this cache or null for anonymous caches.

  - ### get

    public V get(K key)
    Description copied from interface: `Cache`
    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.
    Specified by:
      `get` in interface `Cache<K,V>`
    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

    public boolean containsKey(K key)
    Description copied from interface: `Cache`
    Returns true, if there is a mapping for the specified key.
    Specified by:
      `containsKey` in interface `Cache<K,V>`
    Parameters:
      `key` - key which association should be checked
    Returns:
      `true`, if this cache contains a mapping for the specified key

  - ### put

    public void put(K key, V value)
    Description copied from interface: `Cache`
    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.
    Specified by:
      `put` in interface `Cache<K,V>`
    Parameters:
      `key` - key with which the specified value is associated
      `value` - value to be associated with the specified key

  - ### remove

    public void remove(K key)
    Description copied from interface: `Cache`
    Removes the mapping for a key from the cache if it is present.
    Specified by:
      `remove` in interface `Cache<K,V>`
    Parameters:
      `key` - key which mapping is to be removed from the cache, not null

  - ### clear

    public void clear()
    Description copied from interface: `Cache`
    Clear the cache.
    Specified by:
      `clear` in interface `Cache<K,V>`

  - ### putAll

    public void putAll(Map<K,V> map)
    Specified by:
      `putAll` in interface `Cache<K,V>`
    Parameters:
      `map` -

  - ### shutdown

    public void shutdown()
    Specified by:
      `shutdown` in interface `ShutdownHook`