UNPKG

@yveskaufmann/koa2-ratelimit

Version:

IP rate-limiting middleware for Koajs 2. Use to limit repeated requests to APIs and/or endpoints such as password reset.

58 lines 1.23 kB
/** * RedisStore * * RedisStore for koa2-ratelimit * * @author Ashok Vishwakarma <akvlko@gmail.com> * */ import { RateLimitOptions } from "../Options"; import { HitState, Store } from "./Store"; /** * RedisStore * * Class RedisStore */ export declare class RedisStore extends Store { private client; /** * constructor * @param {*} config * * config is redis config */ constructor(config: any); /** * _hit * @access private * @param {*} key * @param {*} options * @param {*} weight */ private _hit; /** * incr * * Override incr method from Store class * @param {*} key * @param {*} options * @param {*} weight */ incr(key: string, options: RateLimitOptions, weight: number): Promise<HitState>; /** * decrement * * Override decrement method from Store class * @param {*} key * @param {*} options * @param {*} weight */ decrement(key: string, options: RateLimitOptions, weight: number): Promise<void>; /** * saveAbuse * * Override saveAbuse method from Store class */ saveAbuse(): void; } //# sourceMappingURL=RedisStore.d.ts.map