Class SimpleCache<K,​V>


  • public final class SimpleCache<K,​V>
    extends java.lang.Object
    Simple Map implementation usable for caches where contents do not expire, but where size needs to remain bounded.

    Note: we probably should use weak references, or something similar to limit maximum memory usage. This could be implemented in many ways, perhaps by using two areas: first, smaller one, with strong refs, and secondary bigger one that uses soft references.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  SimpleCache.LimitMap<K,​V>  
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleCache​(int maxSize)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(K key, V value)  
      V find​(K key)  
      • Methods inherited from class java.lang.Object

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

      • SimpleCache

        public SimpleCache​(int maxSize)
    • Method Detail

      • find

        public V find​(K key)
      • add

        public void add​(K key,
                        V value)