Creates an instance of the DecayLimiter class with specified configuration. Initializes the decay cache to manage the request scores and sets the half-life and limit properties.
The maximum capacity for the decay cache to store request scores.
The time period (in milliseconds) over which the scores decay.
The maximum score allowed for a request to be considered valid.
Private decaysPrivate limitProcesses a request for a specific key within the rate limiter. The request's score decays over time and is adjusted based on subsequent requests. Checks if the request's score is below the set limit to determine if it's allowed.
The key for which the request is made.
True if the request is allowed based on its decayed score, otherwise false.
Generated using TypeDoc
Class implementing a decay-based rate limiter. Limits requests based on a decay function over time.