Class JPPFSynchronizedSoftCache<K,V>

java.lang.Object
org.jppf.caching.JPPFSynchronizedSoftCache<K,V>
Type Parameters:
K - the type of keys.
V - the type of values.
All Implemented Interfaces:
JPPFMapCache<K,V>

public class JPPFSynchronizedSoftCache<K,V> extends Object implements JPPFMapCache<K,V>
Cache implementation which uses a SoftReferenceValuesMap with synchronized access.
Author:
Laurent Cohen
  • Constructor Details

    • JPPFSynchronizedSoftCache

      public JPPFSynchronizedSoftCache()
  • Method Details

    • put

      public void put(K key, V value)
      Description copied from interface: JPPFMapCache
      Put an element in the cache.
      Specified by:
      put in interface JPPFMapCache<K,V>
      Parameters:
      key - the element's key for retrival.
      value - the element's value.
    • get

      public V get(K key)
      Description copied from interface: JPPFMapCache
      Get an element in the cache.
      Specified by:
      get in interface JPPFMapCache<K,V>
      Parameters:
      key - the element's key.
      Returns:
      the value of the element, or null if the element is not in the cache.
    • remove

      public V remove(K key)
      Description copied from interface: JPPFMapCache
      Remove an element from the cache.
      Specified by:
      remove in interface JPPFMapCache<K,V>
      Parameters:
      key - the element's key.
      Returns:
      the value of the removed element, or null if the element is not in the cache.
    • clear

      public void clear()
      Description copied from interface: JPPFMapCache
      Clear the cache. This removes all elements from the cache.
      Specified by:
      clear in interface JPPFMapCache<K,V>
    • has

      public boolean has(K key)
      Description copied from interface: JPPFMapCache
      Determine whether an entry with the specified key is in the cache.
      Specified by:
      has in interface JPPFMapCache<K,V>
      Parameters:
      key - the key to look up.
      Returns:
      true if the key is in the cache, false otherwise.