intellij-randomness / com.fwdekker.randomness / Cache

Cache

class Cache<K, V>

A simple thread-safe cache of objects.

Parameters

K - the type of keys

V - the type of values

Constructors

<init>

Cache(creator: (K) -> V)

A simple thread-safe cache of objects.

Functions

clear

fun clear(): Unit

Removes all keys and values from the cache.

get

fun get(key: K, useCache: Boolean = true): V

Returns the value that corresponds to key.