resolve cache path at instantiation

This commit is contained in:
Conduitry 2020-10-24 22:52:45 -04:00
parent 9eab9e56eb
commit b7f3a918be
1 changed files with 2 additions and 0 deletions

View File

@ -1,11 +1,13 @@
import { createHash } from 'crypto';
import { promises, writeFileSync } from 'fs';
import { resolve } from 'path';
import { serialize, deserialize } from 'v8';
type Mode = string | number | boolean | null | undefined;
type Cache = Map<string, [any, Set<Mode>]>;
export const autocache = (path: string, mode: Mode) => {
path = resolve(path);
let cache = <Cache>new Map();
const removing = new Set<string>();
const pending = new Map<string, any>();