Class TTLCache

java.lang.Object
NetStrategies.CacheStrategy
NetStrategies.CacheStrategies.TTLCache
All Implemented Interfaces:
AutoCheck

public class TTLCache extends CacheStrategy
TTL (Time To Live) cache eviction strategy: removes items whose lifetime has expired.
  • Constructor Details

  • Method Details

    • getRemoveItem

      public CacheItem getRemoveItem(LinkedList<CacheItem> caches)
      When all the item in cached items list are alive, remove the item follow the specific rule.
      Specified by:
      getRemoveItem in class CacheStrategy
      Parameters:
      caches -
      Returns:
    • cleanExpiredItem

      public void cleanExpiredItem(LinkedList<CacheItem> caches)
      Check each item whether its expired or not. Once expired, remove it from the cached item list.
    • getTTL

      public double getTTL()
    • getReplacePolicy

      public CacheStrategy getReplacePolicy()