Class ConcurrentReferenceCache<K,V>

java.lang.Object
com.aspectran.utils.cache.ConcurrentReferenceCache<K,V>
Type Parameters:
K - the type of the key used for caching
V - the type of the cached values
All Implemented Interfaces:
Cache<K,V>

public class ConcurrentReferenceCache<K,V> extends Object implements Cache<K,V>
A Cache that uses soft or weak references for both keys and values.
Since:
6.6.7
  • Constructor Details

  • Method Details

    • get

      public V get(K key)
      Description copied from interface: Cache
      Gets an entry from the cache.
      Specified by:
      get in interface Cache<K,V>
      Parameters:
      key - the key whose associated value is to be returned
      Returns:
      the element, or null, if it does not exist
    • remove

      public void remove(K key)
      Description copied from interface: Cache
      Removes the specified element from this cache if it is present.
      Specified by:
      remove in interface Cache<K,V>
      Parameters:
      key - key with which the specified value is to be associated
    • clear

      public void clear()
      Description copied from interface: Cache
      Removes all of the elements from this cache.
      Specified by:
      clear in interface Cache<K,V>
    • keySet

      public Set<K> keySet()
      Description copied from interface: Cache
      Returns a Set view of the keys contained in this cache.
      Specified by:
      keySet in interface Cache<K,V>
      Returns:
      the set view
    • size

      public int size()
      Description copied from interface: Cache
      Returns the number of elements in this cache.
      Specified by:
      size in interface Cache<K,V>
      Returns:
      the number of elements in this cache
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Cache
      Returns true if this cache contains no key-value mappings.
      Specified by:
      isEmpty in interface Cache<K,V>
      Returns:
      true if this cache contains no key-value mappings