execute

abstract suspend fun <T> execute(block: suspend () -> T): T

Returns a cached result for the configured key if valid and non-expired; otherwise executes block, caches the result, and returns it.

Return

The cached value or the result of block (after caching).

Parameters

block

The suspendable operation to execute on cache miss or expiry.

Type Parameters

T

The return type of the block and cached value.