Package generic.cache

Class FixedSizeMRUCachingFactory<K,V>

java.lang.Object
generic.cache.FixedSizeMRUCachingFactory<K,V>
Type Parameters:
K - the key used to get a value
V - the value returned for the given key
All Implemented Interfaces:
Factory<K,V>

public class FixedSizeMRUCachingFactory<K,V> extends Object implements Factory<K,V>
An object that will cache values returned from the given factory. This class lets you combine the work of building items as needed with cache maintenance operations, such as get and put (and move, in the case of a sized cache).

The caching of this class is bound by the size parameter of the constructor. Further, the caching strategy is an Most Recently Used strategy, meaning that the least accessed cache items will fall off of the cache.

  • Constructor Details

    • FixedSizeMRUCachingFactory

      public FixedSizeMRUCachingFactory(Factory<K,V> factory, int size)
  • Method Details

    • get

      public V get(K key)
      Specified by:
      get in interface Factory<K,V>