RateLimitProviderConfig
A config for RateLimit provider inside RateLimiterConfig.
Constructors
Functions
Link copied to clipboard
Sets a function that modifies response headers. By default, these headers will be added:
Link copied to clipboard
Sets RateLimit for this provider based on ApplicationCall and key
of this request.
fun rateLimiter(limit: Int, refillPeriod: Duration, initialSize: Int = limit, clock: () -> Long = { getTimeMillis() })
Sets RateLimit for this provider
Link copied to clipboard
Sets a function that returns a key for a request. Requests with different keys will have independent Rate-Limits. Keys should have good equals and hashCode implementations. By default, the key is a Unit, so all requests share the same Rate-Limit.
Link copied to clipboard
Sets a function that returns a weight of a request. Weight is used to calculate how many tokens are consumed by a request. By default, weight is always 1.