Class IntrusiveSoftLRU<T>
java.lang.Object
io.deephaven.util.datastructures.intrusive.IntrusiveSoftLRU<T>
- Type Parameters:
T
- the cached type
- Direct Known Subclasses:
PageCache
A Caching structure that uses simple arrays with doubling, until a threshold is reached. It then switches to an LRU
cache beyond the maximum size.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
An interface defining the required intrusive property getters and setters.static interface
IntrusiveSoftLRU.Node<T extends IntrusiveSoftLRU.Node<T>>
An intrusive node for storing items in the cache. -
Constructor Summary
ConstructorDescriptionIntrusiveSoftLRU
(@NotNull IntrusiveSoftLRU.Adapter<T> adapter, int initialCapacity, int maxCapacity) Create a cache object with the specified initial capacity. -
Method Summary
-
Constructor Details
-
IntrusiveSoftLRU
public IntrusiveSoftLRU(@NotNull @NotNull IntrusiveSoftLRU.Adapter<T> adapter, int initialCapacity, int maxCapacity) Create a cache object with the specified initial capacity. The structure will switch to LRU mode once maxCapacity has been reached.- Parameters:
adapter
- theIntrusiveSoftLRU.Adapter
object for setting the intrusive properties.initialCapacity
- the initial size of the cache.maxCapacity
- the maximum capacity of the cache.
-
-
Method Details
-
touch
Touch an item in the cache. If it has not been visited yet, it will be added, potentially dropping the least recently accessed item in the cache.- Parameters:
itemToTouch
- the item to touch.
-
clear
public void clear()Clear all item from the cache.
-