Class IntrusiveSoftLRU<T>

java.lang.Object
io.deephaven.util.datastructures.intrusive.IntrusiveSoftLRU<T>
Type Parameters:
T - the cached type
Direct Known Subclasses:
PageCache

public class IntrusiveSoftLRU<T> extends Object
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.
  • 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 - the IntrusiveSoftLRU.Adapter object for setting the intrusive properties.
      initialCapacity - the initial size of the cache.
      maxCapacity - the maximum capacity of the cache.
  • Method Details

    • touch

      public void touch(@NotNull T itemToTouch)
      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.