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  Cache.Factory<K,​V>
    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
    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.
    V 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 -
  • 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)