Μετάβαση στο περιεχόμενο

RateLimiterLike

Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.

Defined in: packages/pipeline-rate-limit/src/interfaces/rate-limiter.interface.ts:27

Minimal structural shape of a rate-limiter-flexible limiter (RateLimiterAbstract). Any of its backends — RateLimiterMemory, RateLimiterRedis, RateLimiterMongo, RateLimiterPostgres, RateLimiterMySQL, … — satisfies this interface, so they are genuine drop-in replacements. Add it in your app: pnpm add rate-limiter-flexible.

readonly optional points?: number

Defined in: packages/pipeline-rate-limit/src/interfaces/rate-limiter.interface.ts:36

The configured point capacity per window, when the limiter exposes it.

consume(key, points?): Promise<RateLimiterResLike>

Defined in: packages/pipeline-rate-limit/src/interfaces/rate-limiter.interface.ts:34

Consume points (default 1) for key. Resolves with the updated RateLimiterResLike when allowed, or rejects with a RateLimiterResLike when the limit is exceeded (and with a plain Error when the backing store itself fails).

string

number

Promise<RateLimiterResLike>