import LRU from 'lru-cache'; export declare type Listener = (...as: any[]) => void; export declare type INodeStyleCallBack = (err: Error | null, result?: Success) => void; export interface ResultBase { /** * Returns all keys in the cache. */ keys: () => string[]; /** * Clear the cache. */ reset: () => void; /** * Delete an item given the parameters. */ del: (a1?: T1, a2?: T2, a3?: T3, a4?: T4, a5?: T5, a6?: T6) => void; on(event: 'hit', handler: Listener): void; on(event: 'miss', handler: Listener): void; on(event: 'queue', handler: Listener): void; } export interface IHashingFunction0 { (): string; } export interface IHashingFunction1 { (a1: T1): string; } export interface IHashingFunction2 { (a1: T1, a2: T2): string; } export interface IHashingFunction3 { (a1: T1, a2: T2, a3: T3): string; } export interface IHashingFunction4 { (a1: T1, a2: T2, a3: T3, a4: T4): string; } export interface IHashingFunction5 { (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5): string; } export interface IHashingFunction6 { (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6): string; } export interface IHashingFunctionPlus { (...rest: any[]): string; } export interface IBypassFunction0 { (): boolean; } export interface IBypassFunction1 { (a1: T1): boolean; } export interface IBypassFunction2 { (a1: T1, a2: T2): boolean; } export interface IBypassFunction3 { (a1: T1, a2: T2, a3: T3): boolean; } export interface IBypassFunction4 { (a1: T1, a2: T2, a3: T3, a4: T4): boolean; } export interface IBypassFunction5 { (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5): boolean; } export interface IBypassFunction6 { (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6): boolean; } export interface IBypassFunctionPlus { (...rest: any[]): boolean; } export interface IMaxAgeFunction0 { (res: TResult): number; } export interface IMaxAgeFunction1 { (a1: T1, res: TResult): number; } export interface IMaxAgeFunction2 { (a1: T1, a2: T2, res: TResult): number; } export interface IMaxAgeFunction3 { (a1: T1, a2: T2, a3: T3, res: TResult): number; } export interface IMaxAgeFunction4 { (a1: T1, a2: T2, a3: T3, a4: T4, res: TResult): number; } export interface IMaxAgeFunction5 { (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, res: TResult): number; } export interface IMaxAgeFunction6 { (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, res: TResult): number; } export interface IMaxAgeFunctionPlus { (...rest: any[]): number; } export interface IParamsBase0 extends IParamsBaseCommons { hash: IHashingFunction0; bypass?: IBypassFunction0; itemMaxAge?: IMaxAgeFunction0; } export interface IParamsBase1 extends IParamsBaseCommons { hash: IHashingFunction1; bypass?: IBypassFunction1; itemMaxAge?: IMaxAgeFunction1; } export interface IParamsBase2 extends IParamsBaseCommons { hash: IHashingFunction2; bypass?: IBypassFunction2; itemMaxAge?: IMaxAgeFunction2; } export interface IParamsBase3 extends IParamsBaseCommons { hash: IHashingFunction3; bypass?: IBypassFunction3; itemMaxAge?: IMaxAgeFunction3; } export interface IParamsBase4 extends IParamsBaseCommons { hash: IHashingFunction4; bypass?: IBypassFunction4; itemMaxAge?: IMaxAgeFunction4; } export interface IParamsBase5 extends IParamsBaseCommons { hash: IHashingFunction5; bypass?: IBypassFunction5; itemMaxAge?: IMaxAgeFunction5; } export interface IParamsBase6 extends IParamsBaseCommons { /** * A function to generate the key of the cache. */ hash: IHashingFunction6; /** * Return true if the result should not be retrieved from the cache. */ bypass?: IBypassFunction6; /** * An optional function to indicate the maxAge of an specific item. */ itemMaxAge?: IMaxAgeFunction6; } export interface IParamsBasePlus extends IParamsBaseCommons { hash: IHashingFunctionPlus; bypass?: IBypassFunctionPlus; itemMaxAge?: IMaxAgeFunctionPlus; } interface IParamsBaseCommons extends LRU.Options { /** * 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; } export {};