Class LRUCache<K,V>
java.lang.Object
io.undertow.server.handlers.cache.LRUCache<K,V>
A non-blocking cache where entries are indexed by a key.
To reduce contention, entry allocation and eviction execute in a sampling fashion (entry hits modulo N). Eviction follows an LRU approach (oldest sampled entries are removed first) when the cache is out of capacity.
This cache can also be configured to run in FIFO mode, rather than LRU.
- Author:
- Jason T. Greene, Stuart Douglas
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMax age 0, indicating that entries expire upon creation and are not retained;static final intMage age -1, entries dont expire -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
MAX_AGE_NO_CACHING
public static final int MAX_AGE_NO_CACHINGMax age 0, indicating that entries expire upon creation and are not retained;- See Also:
-
MAX_AGE_NO_EXPIRY
public static final int MAX_AGE_NO_EXPIRYMage age -1, entries dont expire- See Also:
-
-
Constructor Details
-
LRUCache
public LRUCache(int maxEntries, int maxAge) -
LRUCache
public LRUCache(int maxEntries, int maxAge, boolean fifo)
-
-
Method Details
-
add
-
get
-
keySet
-
remove
-
clear
public void clear() -
getMaxEntries
public int getMaxEntries() -
getMaxAge
public int getMaxAge()
-