getOrPut

abstract suspend fun getOrPut(key: K, loader: suspend () -> V): V(source)

This is conceptually similar to ConcurrentHashMap.computeIfAbsent.

Return

the value associated with this key

Since

0.12.0

Parameters

key

the unique key for the desired value

loader

the action to perform if key does not already have a value in the cache. This action is guaranteed only to be performed once per key.