getOrPut

inline fun <K, V> LruCache<K, V>.getOrPut(key: K, defaultValue: () -> V): V

Gets value with specific key from the cache. If the value is not present, calls defaultValue to obtain a non-null value which is placed into the cache, then returned.

This method is thread-safe.