Class LRUCache<K,​T>

  • All Implemented Interfaces:
    Cache<K,​T>

    public abstract class LRUCache<K,​T>
    extends java.lang.Object
    implements Cache<K,​T>
    This class is not thread safe.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<K,​T> cache  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected LRUCache​(int cacheSize)  
    • Field Detail

      • cache

        protected java.util.Map<K,​T> cache
    • Constructor Detail

      • LRUCache

        protected LRUCache​(int cacheSize)
    • Method Detail

      • get

        public T get​(K key)
              throws java.io.IOException
        Specified by:
        get in interface Cache<K,​T>
        Throws:
        java.io.IOException
      • clear

        public void clear()
        Specified by:
        clear in interface Cache<K,​T>
      • put

        public void put​(K key,
                        T value)
      • loadObjectByKey

        protected abstract T loadObjectByKey​(K key)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • removeItem

        public void removeItem​(K key)