Rate Limits
consumeRateLimit
API Reference / modelence / server / consumeRateLimit
consumeRateLimit(
options
):Promise
<void
>
Defined in: src/rate-limit/rules.ts:29
This function will check all rate limit rules on the specified bucket and type, throw an error if any of them are exceeded and increase the count of the rate limit record.
Example
Parameters
Parameter | Type | Description |
---|---|---|
options | { bucket : string ; type : RateLimitType ; value : string ; } | - |
options.bucket | string | The bucket for the rate limit. |
options.type | RateLimitType | The type of the rate limit. |
options.value | string | The value for the rate limit. |
Returns
Promise
<void
>