LruMemoryCache

open class LruMemoryCache<K, V> @JvmOverloads constructor(val capacity: Long, lowWater: Long = (capacity * 0.75).toLong())

LRU cache using an intrusive doubly-linked list for O(1) eviction. The list head is the most recently used entry, the tail is the least recently used; eviction walks tail→head until the cache drops below lowWater and has room for the requested allocation. trimToAge uses the same tail walk and stops at the first entry whose Entry.lastUsed crosses the threshold.

Inheritors

Constructors

Link copied to clipboard
constructor(capacity: Long, lowWater: Long = (capacity * 0.75).toLong())

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open fun clear()
Link copied to clipboard
open fun containsKey(key: K): Boolean
Link copied to clipboard
open operator fun get(key: K): V?
Link copied to clipboard
open fun put(key: K, value: V, size: Int): V?
Link copied to clipboard
open fun remove(key: K): V?
Link copied to clipboard
open fun trimToAge(maxAge: Long): Int
Link copied to clipboard
open fun updateSize(key: K, newSize: Int): Unit?