UNPKG

redis-sliding-rate-limiter

Version:

Flexible and performant rate limiter based on sliding window algorithm with arbitrary precision

20 lines (19 loc) 489 B
type FactorMapper = { [key in Unit]: number; }; export declare enum Unit { MILLISECOND = -3, CENTISECOND = -2, DECISECOND = -1, SECOND = 0, MINUTE = 1, HOUR = 2, DAY = 3, WEEK = 4, MONTH = 5, YEAR = 6 } export declare const WindowUnitToMilliseconds: FactorMapper; export declare const MicrosecondsToWindowSubdivision: FactorMapper; export declare const convertWindowUnitToSubdivision: (windowUnit: Unit, subdivision: Unit) => number; export {};