UNPKG

927 BTypeScriptView Raw
1// Type definitions for flat-cache 2.0
2// Project: https://github.com/royriojas/flat-cache#readme
3// Definitions by: Kevin Pollet <https://github.com/kevinpollet>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6export interface Cache {
7 load(cacheId: string, cacheDir?: string): void;
8 loadFile(pathToFile: string): void;
9 all(): { [key: string]: any };
10 keys(): string[];
11 setKey(key: string, value: any): void;
12 removeKey(key: string): void;
13 getKey(key: string): any;
14 save(noPrune?: boolean): void;
15 removeCacheFile(): boolean;
16 destroy(): void;
17}
18
19export function load(cacheId: string, cacheDir?: string): Cache;
20
21export function create(cacheId: string, cacheDir?: string): Cache;
22
23export function createFromFile(filePath: string): Cache;
24
25export function clearCacheById(cacheId: string, cacheDir?: string): boolean;
26
27export function clearAll(cacheDir?: string): boolean;