> ## Documentation Index
> Fetch the complete documentation index at: https://docs.limitem.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Algorithms

> Four ways to say "not yet." Internally.

Pick one per limiter. Switching algorithms for the same `namespace` + `identifier` starts a new counter — they don't share state.

| Algorithm        | Burst                 | Reset         | Best for                       |
| ---------------- | --------------------- | ------------- | ------------------------------ |
| `fixed-window`   | Yes, at window edges  | Hard wall     | Simple quotas, caches, default |
| `sliding-window` | No                    | Continuous    | Fair usage, precise caps       |
| `token-bucket`   | Yes, up to `limit`    | Steady refill | APIs that can take a spike     |
| `leaky-bucket`   | Absorbs, then rejects | Steady leak   | Smoothing bursty input         |

Default is `fixed-window`.

<CardGroup cols={2}>
  <Card title="Fixed Window" icon="border-all" href="/algorithms/fixed-window">
    Discrete windows. Fast. Can allow 2× at the boundary.
  </Card>

  <Card title="Sliding Window" icon="chart-line" href="/algorithms/sliding-window">
    Exact timestamps. No cliff.
  </Card>

  <Card title="Token Bucket" icon="droplet" href="/algorithms/token-bucket">
    Start full. Spend tokens. They refill over the duration.
  </Card>

  <Card title="Leaky Bucket" icon="faucet" href="/algorithms/leaky-bucket">
    Fill the bucket. It leaks at a constant rate. Overflow rejects.
  </Card>
</CardGroup>
