RateLimiter

interface RateLimiter

Interface for rate limiters implementations. A rate limiter is a component that allows to limit the rate of some actions

Inheritors

Functions

Link copied to clipboard
abstract suspend fun awaitUntilTake()

Wait until a token is available.

abstract suspend fun awaitUntilTake(key: String)

Wait until a token for the given key is available.

Link copied to clipboard
abstract suspend fun tryTake(): Boolean

Try to take a token from the rate limiter.

abstract suspend fun tryTake(key: String): Boolean

Try to take a token for the given key from the rate limiter.