• Preparing search index...
  • The search index is not available
@daiso-tech/core - v0.56.0
  • @daiso-tech/core
  • RateLimiter
  • withRateLimiterFactory

Function withRateLimiterFactory

  • withRateLimiterFactory(
        rateLimiterFactory: IRateLimiterFactory,
    ): <TParameters extends unknown[], TReturn>(
        settings: WithRateLimiterSettings<TParameters>,
    ) => MiddlewareFn<TParameters, Promise<TReturn>>
  • A higher-order function that creates a middleware factory which wraps function calls with a rate limiter.

    Each unique key (derived from the wrapped function's arguments) gets its own rate-limit counter. When the maximum number of invocations (limit) is exceeded within the configured window subsequent calls throw a rate-limit error instead of executing the wrapped function.

    Parameters

    • rateLimiterFactory: IRateLimiterFactory

      The rate-limiter factory to use.

    Returns <TParameters extends unknown[], TReturn>(
        settings: WithRateLimiterSettings<TParameters>,
    ) => MiddlewareFn<TParameters, Promise<TReturn>>

    A higher-order function that accepts WithRateLimiterSettings and returns a MiddlewareFn.

    IMPORT_PATH: "@daiso-tech/core/rate-limiter/middlewares"

    • Defined in src/rate-limiter/implementations/middlewares/with-rate-limiter/with-rate-limiter-factory.ts:59

Settings

Member Visibility
@daiso-tech/core - v0.56.0
  • Loading...

Generated using TypeDoc