getOrPut

open suspend override fun getOrPut(key: String, creationFunction: suspend (String) -> Boolean): String?

Returns the file corresponding to the given key if it exists or is currently being created, a new file serialized by creationFunction, or null if the creation fails.

The function waits for the creation to complete if it is in progress. If the creation fails, the function returns null. Any unhandled exceptions inside the creation block will be thrown. creationFunction is NOT used as a fallback if the current creation fails.

creationFunction should return true if the creation was successful, and false otherwise.