UNPKG

@routup/rate-limit-redis

Version:

Red adapter for the routup rate-limit plugin.

47 lines 1.3 kB
import type { Client } from 'redis-extension'; import type { IncrementResponse, Options, Store } from '@routup/rate-limit'; export declare class RedisStore implements Store { options: Options; client: Client; constructor(connectionString?: string); /** * Method that initializes the store. * * @param options {Options} - The options used to setup the middleware. */ init(options: Options): void; /** * Method to increment a client's hit counter. * * @param key {string} - The identifier for a client. * * @returns {IncrementResponse} - The number of hits and reset time for that client. * * @public */ increment(key: string): Promise<IncrementResponse>; /** * Method to decrement a client's hit counter. * * @param key {string} - The identifier for a client. * * @public */ decrement(key: string): Promise<void>; /** * Method to reset a client's hit counter. * * @param key {string} - The identifier for a client. * * @public */ reset(key: string): Promise<void>; /** * Method to build redis key. * * @param key * @protected */ protected buildKey(key: string): string; } //# sourceMappingURL=module.d.ts.map