# MemoryRateLimiter

`class` in `rate-limiter` · v0.1.0-next.3

<https://docs.seedcord.org/packages/rate-limiter/0.1.0-next.3/classes/memory-rate-limiter>

The in-memory IRateLimiter with an exact sliding window per key. The gateway default behind `core.rateLimiter`.

Each key holds its live uses' expiry times. State is per-process and lost on restart. Expired keys are dropped on the first access at least a minute after the previous sweep.

```ts
class MemoryRateLimiter implements Store<"charge">
```

## Properties

### size

```ts
public get size(): number
```

Number of keys currently tracked.

## Methods

### charge

```ts
public async charge(
    key: string,
    window: RateLimitWindow
): Promise<RateLimitResult>
```

### peek

```ts
public async peek(
    key: string,
    window: RateLimitWindow
): Promise<RateLimitResult>
```

### reset

```ts
public async reset(key: string): Promise<void>
```
