Class stl_SimpleCache<K,​V>

java.lang.Object
com.jackmeng.stl.stl_SimpleCache<K,​V>

public class stl_SimpleCache<K,​V>
extends java.lang.Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    private class  stl_SimpleCache.CacheEntry<T>  
    private class  stl_SimpleCache.CleanupTask  
  • Field Summary

    Fields
    Modifier and Type Field Description
    private java.util.Map<K,​stl_SimpleCache.CacheEntry<V>> cache  
    private java.util.Timer cleanupTimer  
    private long timeoutMillis  
    private long toleranceMillis  
  • Constructor Summary

    Constructors
    Constructor Description
    stl_SimpleCache​(long timeoutMillis, long toleranceMillis)  
  • Method Summary

    Modifier and Type Method Description
    V get​(K key)  
    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 Details

    • cache

      private final java.util.Map<K,​stl_SimpleCache.CacheEntry<V>> cache
    • timeoutMillis

      private final long timeoutMillis
    • toleranceMillis

      private final long toleranceMillis
    • cleanupTimer

      private final java.util.Timer cleanupTimer
  • Constructor Details

    • stl_SimpleCache

      public stl_SimpleCache​(long timeoutMillis, long toleranceMillis)
  • Method Details

    • put

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

      public V get​(K key)