CoalescingPolicy

A policy that coalesces concurrent requests by key.

Unlike com.santimattius.resilient.cache.CachePolicy, this policy does not cache completed results. It only deduplicates in-flight executions: concurrent callers that resolve to the same key will share a single in-flight operation and all await the same Deferred result.

Implementation detail: the shared in-flight operation is launched in the provided ResilientScope so cancelling the first caller does not cancel the shared operation needed by other concurrent callers.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun <T> execute(block: suspend () -> T): T