Class TTLCache
java.lang.Object
NetStrategies.CacheStrategy
NetStrategies.CacheStrategies.TTLCache
- All Implemented Interfaces:
AutoCheck
TTL (Time To Live) cache eviction strategy: removes items whose lifetime has expired.
-
Field Summary
Fields inherited from class CacheStrategy
engine, netSystem, removeItemMode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanExpiredItem(LinkedList<CacheItem> caches) Check each item whether its expired or not.getRemoveItem(LinkedList<CacheItem> caches) When all the item in cached items list are alive, remove the item follow the specific rule.doublegetTTL()Methods inherited from class CacheStrategy
check, getRemoveItemMode, setNetSystem, setRandomEngine, setRemoveItemMode
-
Constructor Details
-
TTLCache
-
-
Method Details
-
getRemoveItem
When all the item in cached items list are alive, remove the item follow the specific rule.- Specified by:
getRemoveItemin classCacheStrategy- Parameters:
caches-- Returns:
-
cleanExpiredItem
Check each item whether its expired or not. Once expired, remove it from the cached item list. -
getTTL
public double getTTL() -
getReplacePolicy
-