Package-level declarations

Types

Link copied to clipboard
typealias Execute<T> = suspend () -> T

Type alias for a suspendable block that produces a value of type T. Used internally when composing resilience policy wrappers.

Link copied to clipboard

Represents the types of resilience policies that can have their composition order configured.

Link copied to clipboard

A DSL builder for creating and configuring a composition of resilience policies.

Link copied to clipboard
class ResilientScope(dispatcher: CoroutineDispatcher = Dispatchers.Default) : AutoCloseable

Manages a CoroutineScope for internal background tasks within resilience policies, such as cache cleanup (when com.santimattius.resilient.cache.CacheConfig.cleanupInterval is set).

Functions

Link copied to clipboard
fun CoroutineScope.asResilientScope(): ResilientScope

Wraps this CoroutineScope as a ResilientScope that participates in the caller's coroutine hierarchy.

Link copied to clipboard
fun resilient(resilientScope: ResilientScope, block: ResilientBuilder.() -> Unit): ResilientPolicy

Builds a ResilientPolicy by composing configured policies.

Link copied to clipboard
fun CoroutineScope.resilient(block: ResilientBuilder.() -> Unit): ResilientPolicy

Shorthand for building a ResilientPolicy bound to the lifecycle of this CoroutineScope.