Stone.js API
    Preparing search index...

    Fixed-window limiter counting in this process. The zero-config default, and the right one for a single server.

    It is not a limit on a function-as-a-service deployment, and that is worth saying plainly. Each instance counts on its own, so a budget of three allows three per warm container, resets on every cold start, and grants the whole budget again to every new instance. Under the traffic that warrants a limiter at all, that is no limiter. Configure a shared one there, or register your own with limiters: [{ name, factory }].

    Implements

    Index
    • Forget everything counted so far.

      A store that can only grow is not a store. Mostly for a test that wants a clean slate: an application calling this mid-flight is handing every caller a fresh budget.

      Returns void

    • Count one hit and say whether it may proceed.

      Parameters

      • key: string

        What the budget belongs to.

      • limit: number

        How many hits the window allows.

      • windowMs: number

        How long the window lasts.

      Returns Promise<RateLimitHit>

      The verdict.