Package-level declarations

Types

Link copied to clipboard

A multiset that tracks how many times each element has been added.

Link copied to clipboard
class LruCache<K, V>(val maxSize: Int)

A fixed-capacity cache that evicts the least recently used entry first.

Link copied to clipboard
class ObjectPool<T>(val capacity: Int, factory: () -> T, reset: (T) -> Unit = {})

A bounded pool that reuses instances instead of creating new ones.

Link copied to clipboard
class OnceFlag

A resettable flag that runs a block at most once between resets.

Link copied to clipboard
class RingBuffer<T>(val capacity: Int) : Iterable<T>

A fixed-capacity buffer that overwrites its oldest element when full.

Link copied to clipboard
open class SingletonHolder<T, A>(creator: (A) -> T)

A base class for singletons that need one construction argument.

Link copied to clipboard
class TtlCache<K, V>(val ttl: Duration, val maxSize: Int = Int.MAX_VALUE, timeSource: TimeSource.WithComparableMarks = TimeSource.Monotonic)

A cache whose entries expire once ttl has elapsed since they were stored.

Link copied to clipboard
class TypedKey<T>(val name: String)

A key for a TypedMap that carries the type of its value.

Link copied to clipboard
class TypedMap

A heterogeneous map whose values are typed by their TypedKey.

Functions

Link copied to clipboard
fun <A, R> memoize(fn: (A) -> R): (A) -> R

Returns a function that caches every result of fn by argument.

fun <A, B, R> memoize(fn: (A, B) -> R): (A, B) -> R

Returns a function that caches every result of fn by argument pair.