cache-api-local
Version:
A lib to use for caching the api res so your load to serve minimize. Plus it has revalidating feature 🔥🔥
16 lines (14 loc) • 531 B
TypeScript
declare class CacheApi {
readonly basePath: string;
readonly actualBaseCachePath: string;
readonly maxAge?: number;
constructor(basePath: string, relativeCacheFolderName: string, maxAge?: number);
private sanitizeFilename;
private readJSONSafe;
private writeJSON;
private getFilePaths;
getData(urlPath: string, subFolder: string, options?: RequestInit, bypassCacheCheck?: boolean): Promise<any>;
private checkAndReadFromCache;
private ensureDirExists;
}
export { CacheApi as default };