LRUCache
fun <K, V> LRUCache( softCapacity: Int, strongCapacity: Int, transformer: (K) -> V, retirementAction: (K, V) -> Unit? = null)
Content copied to clipboard
Construct a new LRUCache.
Parameters
K
The type of the keys.
V
The type of the values.
soft Capacity
The capacity of the cache. This is the maximum number of cached values that will ever be retained simultaneously. Must be greater than zero (0).
strong Capacity
The maximum number of cached values that will be strongly retained to prevent garbage collection. Must be less than or equal to the capacity.
transformer
The function responsible for producing new values from user-supplied keys. Must not produce null.
retirement Action
The action responsible for retiring a binding expired from the cache, or null if no such action should be performed.