@vtex/api
Version:
VTEX I/O API client
22 lines (21 loc) • 789 B
TypeScript
import { CacheLayer } from './CacheLayer';
import { LRUDiskCacheOptions, LRUStats } from './typings';
import { outputJSON, readJSON } from 'fs-extra';
export declare class LRUDiskCache<V> implements CacheLayer<string, V> {
private cachePath;
private readFile;
private writeFile;
private lock;
private disposed;
private hits;
private total;
private lruStorage;
private keyToBeDeleted;
constructor(cachePath: string, options: LRUDiskCacheOptions, readFile?: typeof readJSON, writeFile?: typeof outputJSON);
has: (key: string) => boolean;
getStats: (name?: string) => LRUStats;
get: (key: string) => Promise<V | void>;
set: (key: string, value: V, maxAge?: number) => Promise<boolean>;
private getPathKey;
private deleteFile;
}