public class LRUCache<K,V> extends Object
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
LRUCache.CacheEntry<K,V> |
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_AGE_NO_CACHING
Max age 0, indicating that entries expire upon creation and are not retained;
|
static int |
MAX_AGE_NO_EXPIRY
Mage age -1, entries dont expire
|
| Constructor and Description |
|---|
LRUCache(int maxEntries,
int maxAge) |
LRUCache(int maxEntries,
int maxAge,
boolean fifo) |
public static final int MAX_AGE_NO_CACHING
public static final int MAX_AGE_NO_EXPIRY
Copyright © 2024 JBoss by Red Hat. All rights reserved.