Cache

class Cache<K, V>(creator: (K) -> V)

A simple thread-safe cache of objects.

Parameters

K

the type of keys

V

the type of values

creator

a function that maps a key to a value, used to instantiate a value when it is requested and not in the cache

Constructors

Cache
Link copied to clipboard
fun <K, V> Cache(creator: (K) -> V)
the type of keys

Functions

clear
Link copied to clipboard
@Synchronized()
fun clear()
Removes all keys and values from the cache.
get
Link copied to clipboard
@Synchronized()
fun get(key: K, useCache: Boolean = true): V
Returns the value that corresponds to key.

Sources

jvm source
Link copied to clipboard