ThrottlerStorage


interface ThrottlerStorage {
  storage: Record<string, ThrottlerStorageOptions>
  increment(key: string, ttl: number): Promise<ThrottlerStorageRecord>
}

Properties

Property Description
storage: Record<string, ThrottlerStorageOptions>

The internal storage with all the request records. The key is a hashed key based on the current context and IP.

Methods

increment()

Increment the amount of requests for a given record. The record will automatically be removed from the storage once its TTL has been reached.


increment(key: string, ttl: number): Promise<ThrottlerStorageRecord>

Parameters

Option Type Description
key string
ttl number

Returns

Promise<ThrottlerStorageRecord>