Companion

object Companion

Functions

Link copied to clipboard
fun <K, V> lru(capacity: Int = 5): Cache<K, V>

Creates a new LRU (least recently used) cache of the given capacity: whenever a new key-value pair would exceed capacity, the least recently inserted pair is evicted to make room for it.

Link copied to clipboard
fun <K, V> simpleLru(capacity: Int = 5): Cache<K, V>

Creates a new LRU (least recently used) cache of the given capacity, using a simpler (less memory-consuming, but functionally equivalent) implementation than the one returned by lru.