Sliding window log.
also: sliding-window logStoring the timestamp of every request and counting those inside the last window: exact, but memory grows with traffic.
the two-minute refresher
- Drop timestamps older than the window, count the rest, allow if under the limit.
- Exact: no boundary bursts.
- Memory is one entry per request per key, expensive at high volume.
- Use it when accuracy is critical and limits are small.