Type Alias IRateLimiterStorageAdapter<TType>

IRateLimiterStorageAdapter: {
    find(key: string): Promise<null | IRateLimiterData<TType>>;
    remove(key: string): Promise<void>;
    transaction<TValue>(
        fn: InvokableFn<
            [transaction: IRateLimiterStorageAdapterTransaction<TType>],
            Promise<TValue>,
        >,
    ): Promise<TValue>;
}

The IRateLimiterStorageAdapter contract defines a way for storing rate limiter state independent of the underlying technology. This contract simplifies the implementation of rate limiter adapters with CRUD-based databases, such as SQL databases and ORMs like TypeOrm and MikroOrm.

IMPORT_PATH: "@daiso-tech/core/rate-limiter/contracts"

Type Parameters

  • TType = unknown

Type declaration