UNPKG

999 BTypeScriptView Raw
1export type FileSystemCacheOptions = {
2 basePath?: string;
3 ns?: any;
4 extension?: string;
5 ttl?: number;
6};
7export declare class FileSystemCache {
8 basePath: string;
9 ns?: any;
10 extension?: string;
11 basePathExists?: boolean;
12 ttl: number;
13 constructor(options?: FileSystemCacheOptions);
14 path(key: string): string;
15 fileExists(key: string): Promise<boolean>;
16 ensureBasePath(): Promise<void>;
17 get(key: string, defaultValue?: any): Promise<any>;
18 getSync(key: string, defaultValue?: any): any;
19 set(key: string, value: any, ttl?: number): Promise<{
20 path: string;
21 }>;
22 setSync(key: string, value: any, ttl?: number): this;
23 remove(key: string): Promise<void>;
24 clear(): Promise<void>;
25 save(input: ({
26 key: string;
27 value: any;
28 } | null | undefined)[]): Promise<{
29 paths: string[];
30 }>;
31 load(): Promise<{
32 files: {
33 path: string;
34 value: any;
35 }[];
36 }>;
37}