Class ConcurrentCache<K,V>

java.lang.Object
com.sun.faces.util.ConcurrentCache<K,V>
Direct Known Subclasses:
ExpiringConcurrentCache

public abstract class ConcurrentCache<K,V> extends Object
Defines a concurrent cache with a factory for creating new object instances. This (combined with ExpiringConcurrentCache) offers functionality similar to com.sun.faces.util.Cache. Two differences: 1. Cache is concrete/assumes a particular implementation. ConcurrentCache is abstract/allows subclasses to provide the implementation. This facilitates alternative implementations, such as DefaultFaceletCache's NoCache. 2. ConcurrentCache does not provide remove() as part of its contract, since remove behavior may be subclass-specific. For example, ExpiringConcurentCache automatically removes items by checking for expiration rather than requiring manual removes. We should consider consolidating Cache and ConcurrentCache + ExpiringConcurrentCache into a single class hierarchy so that we do not need to duplicate the JCIP scalable result cache code.
  • Constructor Details

    • ConcurrentCache

      public ConcurrentCache(ConcurrentCache.Factory<K,V> f)
      Constructs this cache using the specified Factory.
      Parameters:
      f -
  • Method Details

    • get

      public abstract V get(K key) throws ExecutionException
      Retrieves a value for the specified key. If the value is not already present in the cache, a new instance will be allocated using the Factory interface
      Parameters:
      key - the key the value is associated with
      Returns:
      the value for the specified key
      Throws:
      ExecutionException
    • containsKey

      public abstract boolean containsKey(K key)
      Tests whether the cache contains a value for the specified key
      Parameters:
      key - key to test
      Returns:
      true if the value for the specified key is already cached, false otherwise
    • getFactory

      protected final ConcurrentCache.Factory<K,V> getFactory()
      Retrieves a Factory instance aasociated with this cache
      Returns:
      Factory instance