Class Cache<K,V>

java.lang.Object
com.sun.faces.util.Cache<K,V>

public class Cache<K,V> extends Object
A concurrent caching mechanism.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Factory interface for creating various cacheable objects.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Cache(Cache.Factory<K,V> factory)
    Constructs this cache using the specified Factory.
  • Method Summary

    Modifier and Type
    Method
    Description
    get(K key)
    If a value isn't associated with the specified key, a new Callable will be created wrapping the Factory specified via the constructor and passed to a FutureTask.
    remove(K key)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Cache

      public Cache(Cache.Factory<K,V> factory)
      Constructs this cache using the specified Factory.
      Parameters:
      factory - a factory to create or retrieve the element that need to be cached
  • Method Details

    • get

      public V get(K key)
      If a value isn't associated with the specified key, a new Callable will be created wrapping the Factory specified via the constructor and passed to a FutureTask. This task will be passed to the backing ConcurrentMap. When FutureTask.get() is invoked, the Factory will return the new Value which will be cached by the FutureTask.
      Parameters:
      key - the key the value is associated with
      Returns:
      the value for the specified key, if any
    • remove

      public V remove(K key)