@canmertinyo/rate-limiter-memcached
Version:
A simple rate-limiting middleware for Express.js with support for in-memory, Redis, and MongoDB storage
14 lines (13 loc) • 696 B
TypeScript
import { RateLimiter, RateLimitRecord } from "@canmertinyo/rate-limiter-core";
import Memcached from "memcached";
export declare class MemcachedStore implements RateLimiter {
private readonly server;
private readonly memcachedOptions;
private memcached;
constructor(server: string | string[], memcachedOptions: Memcached.options);
initialize(): Promise<RateLimiter>;
getRateLimitRecord(key: string): Promise<RateLimitRecord | undefined>;
createRateLimitRecord(record: RateLimitRecord): Promise<RateLimitRecord>;
updateRateLimitRecord(key: string, timestamp: number, count: number): Promise<RateLimitRecord>;
increment(key: string): Promise<RateLimitRecord>;
}