getOrCreate

fun getOrCreate(name: String, configure: RateLimiterConfig.() -> Unit, onRateLimited: suspend (Duration) -> Unit? = null): DefaultRateLimiter

Returns an existing DefaultRateLimiter for name, or creates one with configure.

Parameters

name

Logical name identifying the shared limiter (e.g. "payments", "db").

configure

Lambda to configure RateLimiterConfig — only applied on first creation.

onRateLimited

Optional suspendable callback forwarded to DefaultRateLimiter only when the instance is first created. Receives the wait Duration before the rate-limited call is allowed or rejected.