Skip to main content
Time is split into non-overlapping chunks of duration seconds. Each chunk has its own counter. When the clock crosses the boundary, the counter is gone.

When to use it

Default for a reason. It’s O(1), cheap, and easy to reason about. Use it when a burst at the window edge is acceptable — caches, “100 emails per hour”, anything that doesn’t need perfectly even traffic.

The catch

A client can spend the whole limit at 59s, then spend it again at 60s. That’s 2× in two seconds. If that matters, use sliding window.

Shape

boolean
true until count would exceed limit.
number
limit - count, floored at 0.
number
Unix timestamp of the next window boundary.