import LRU from 'lru-cache'; export declare type Listener = (...args: any[]) => void; export declare type INodeStyleCallBack = (err: Error, result?: SuccessArg) => void; export interface ResultBase { /** * Returns all keys in the cache. */ keys: () => string[]; /** * Clear the cache. */ reset: () => void; /** * Delete an item given the parameters. */ del: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => void; on(event: 'hit', handler: Listener): void; on(event: 'miss', handler: Listener): void; on(event: 'queue', handler: Listener): void; } export interface IHashingFunction { (): string; (arg1: T1): string; (arg1: T1, arg2: T2): string; (arg1: T1, arg2: T2, arg3: T3): string; (arg1: T1, arg2: T2, arg3: T3, arg4: T4): string; (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): string; (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6): string; (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6): string; (...rest: any[]): string; } export interface IBypassFunction { (): boolean; (arg1: T1): boolean; (arg1: T1, arg2: T2): boolean; (arg1: T1, arg2: T2, arg3: T3): boolean; (arg1: T1, arg2: T2, arg3: T3, arg4: T4): boolean; (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): boolean; (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6): boolean; (...rest: any[]): boolean; } export interface IMaxAgeFunction { (res: TResult): number; (arg1: T1, res: TResult): number; (arg1: T1, arg2: T2, res: TResult): number; (arg1: T1, arg2: T2, arg3: T3, res: TResult): number; (arg1: T1, arg2: T2, arg3: T3, arg4: T4, res: TResult): number; (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, res: TResult): number; (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, res: TResult): number; (...rest: any[]): number; } export interface IParamsBase extends LRU.Options { /** * A function to generate the key of the cache. */ hash: IHashingFunction; /** * Return true if the result should not be retrieved from the cache. */ bypass?: IBypassFunction; /** * An optional function to indicate the maxAge of an specific item. */ itemMaxAge: IMaxAgeFunction; /** * Indicates if the resource should be freezed. */ freeze?: boolean; /** * Indicates if the resource should be cloned before is returned. */ clone?: boolean; /** * Disable the cache and executes the load logic directly. */ disable?: boolean; /** * Do not queue requests if initial call is more than `queueMaxAge` milliseconds old. * Instead, invoke `load` again and create a new queue. * Defaults to 1000ms. */ queueMaxAge?: number; }