Package generic.cache

Class 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 java.lang.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.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      V get​(K key)  
      • Methods inherited from class java.lang.Object

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

      • FixedSizeMRUCachingFactory

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

      • get

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