Class BasicCache<K,​V>

  • Direct Known Subclasses:
    ComputingCache

    public class BasicCache<K,​V>
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<K,​V> internal  
      static int MAX_CACHE_SIZE  
    • Constructor Summary

      Constructors 
      Constructor Description
      BasicCache()  
      BasicCache​(int capacity)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      V getOrCompute​(K key, java.util.function.Function<K,​V> computer)  
      V getOrElse​(K key, java.util.function.Function<K,​V> computer)  
      void put​(K key, V value)  
      • Methods inherited from class java.lang.Object

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

      • internal

        protected final java.util.Map<K,​V> internal
    • Constructor Detail

      • BasicCache

        public BasicCache()
      • BasicCache

        public BasicCache​(int capacity)
    • Method Detail

      • put

        public void put​(K key,
                        V value)
      • getOrElse

        public V getOrElse​(K key,
                           java.util.function.Function<K,​V> computer)
      • getOrCompute

        public V getOrCompute​(K key,
                              java.util.function.Function<K,​V> computer)