# CooldownManager

`class` in `services` · v0.7.1

<https://docs.seedcord.org/packages/services/0.7.1/classes/cooldown-manager>

Lightweight utility for per-key cooldowns.

Manages time-based restrictions on operations by key, useful for rate limiting, command cooldowns, and spam prevention.

```ts
class CooldownManager
```

## Constructors

### constructor

```ts
CooldownManager(opts?: CooldownOptions)
```

Creates a new CooldownManager instance.

## Methods

### check

```ts
public check(key: string): void
```

Verifies cooldown status for a key and updates timestamp if not active.

If the cooldown is still active, throws the configured error. If not active, updates the timestamp and returns successfully.

### clear

```ts
public clear(key: string): void
```

Removes a key from the cooldown map.

### isActive

```ts
public isActive(key: string): boolean
```

Checks if a key is currently cooling down without updating timestamp.

### set

```ts
public set(key: string): void
```

Records usage timestamp for a key without any cooldown checks.
