Type Alias IRateLimiterData<TType>

IRateLimiterData: { expiration: Date; state: TType }

Persisted rate limiter state data. Contains the metrics/state object and expiration information for stored rate limiters.

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

Type Parameters

  • TType = unknown

    The type of metrics/state object stored (defined by the policy)

Type declaration

  • expiration: Date

    The expiration date and time for this rate limiter state. Data with past expiration dates should be considered stale and can be cleaned up. Determined by the policy's getExpiration() method.

  • state: TType

    The serialized metrics/state object from the rate limiter policy. This is the persistent representation of attempt tracking and window information. The exact structure depends on the policy algorithm (e.g., fixed-window, sliding-window).