import { LRUCache } from 'lru-cache'; export type Listener = (...as: any[]) => void; export 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 ITTLFunction0 { (res: TResult): number; } export interface ITTLFunction1 { (a1: T1, res: TResult): number; } export interface ITTLFunction2 { (a1: T1, a2: T2, res: TResult): number; } export interface ITTLFunction3 { (a1: T1, a2: T2, a3: T3, res: TResult): number; } export interface ITTLFunction4 { (a1: T1, a2: T2, a3: T3, a4: T4, res: TResult): number; } export interface ITTLFunction5 { (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, res: TResult): number; } export interface ITTLFunction6 { (a1: T1, a2: T2, a3: T3, a4: T4, a5: T5, a6: T6, res: TResult): number; } export interface ITTLFunctionPlus { (...rest: any[]): number; } export type IParamsBase0 = IParamsBaseCommons & { hash: IHashingFunction0; bypass?: IBypassFunction0; itemTTL?: ITTLFunction0; }; export type IParamsBase1 = IParamsBaseCommons & { hash: IHashingFunction1; bypass?: IBypassFunction1; itemTTL?: ITTLFunction1; }; export type IParamsBase2 = IParamsBaseCommons & { hash: IHashingFunction2; bypass?: IBypassFunction2; itemTTL?: ITTLFunction2; }; export type IParamsBase3 = IParamsBaseCommons & { hash: IHashingFunction3; bypass?: IBypassFunction3; itemTTL?: ITTLFunction3; }; export type IParamsBase4 = IParamsBaseCommons & { hash: IHashingFunction4; bypass?: IBypassFunction4; itemTTL?: ITTLFunction4; }; export type IParamsBase5 = IParamsBaseCommons & { hash: IHashingFunction5; bypass?: IBypassFunction5; itemTTL?: ITTLFunction5; }; export type IParamsBase6 = 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 ttl of an specific item. */ itemTTL?: ITTLFunction6; }; export type IParamsBasePlus = IParamsBaseCommons & { hash: IHashingFunctionPlus; bypass?: IBypassFunctionPlus; itemTTL?: ITTLFunctionPlus; }; type IParamsBaseCommons = LRUCache.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 `queueTTL` milliseconds old. * Instead, invoke `load` again and create a new queue. * Defaults to 1000ms. */ queueTTL?: number; }; export {}; //# sourceMappingURL=util.d.ts.map