@daiso-tech/core
Version:
The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.
24 lines (23 loc) • 847 B
TypeScript
/**
* @module RateLimiter
*/
import { type CacheWriteSettings, type ICacheBase } from "../../../cache/contracts/_module.js";
import { type MiddlewareFn } from "../../../middleware/contracts/_module.js";
import { type Invokable } from "../../../utilities/_module.js";
/**
* @group Middleware
*/
export type CacheMiddlewareSettings<TParameters extends Array<unknown> = Array<unknown>> = CacheWriteSettings & {
/**
* @default
* ```ts
* (...args) => JSON.stringify(args)
* ```
*/
key?: Invokable<TParameters, string>;
};
/**
* IMPORT_PATH: `"@daiso-tech/core/cache/middlewares"`
* @group Middleware
*/
export declare function cacheMiddlewareFactory(cache: ICacheBase): <TParameters extends Array<unknown>, TReturn>(settings: CacheMiddlewareSettings<TParameters>) => MiddlewareFn<TParameters, Promise<TReturn>>;