type config & remove await from memoryCache

This commit is contained in:
Michael C
2021-07-05 02:59:01 -04:00
parent 351c89f235
commit d29c9613b9
3 changed files with 4 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
export function createMemoryCache(memoryFn: (...args: any[]) => void, cacheTimeMs: number) {
export function createMemoryCache(memoryFn: (...args: any[]) => void, cacheTimeMs: number): any {
if (isNaN(cacheTimeMs)) cacheTimeMs = 0;
// holds the promise results
@@ -22,8 +22,8 @@ export function createMemoryCache(memoryFn: (...args: any[]) => void, cacheTimeM
}
}
// create new promise
const promise = new Promise(async (resolve) => {
resolve((await memoryFn(...args)));
const promise = new Promise((resolve) => {
resolve(memoryFn(...args));
});
// store promise reference until fulfilled
promiseMemory.set(cacheKey, promise);