LRUCache

fun <K, V> LRUCache(    softCapacity: Int,     strongCapacity: Int,     transformer: (K) -> V,     retirementAction: (K, V) -> Unit? = null)

Construct a new LRUCache.

Parameters

K

The type of the keys.

V

The type of the values.

softCapacity

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).

strongCapacity

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.

retirementAction

The action responsible for retiring a binding expired from the cache, or null if no such action should be performed.