async-cache-dedupe
Advanced tools
Comparing version 1.4.1 to 1.4.2
{ | ||
"name": "async-cache-dedupe", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "An async deduping cache", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -283,3 +283,3 @@ 'use strict' | ||
// clear the dedupe once done | ||
this.dedupes.set(key, undefined) | ||
this.dedupes.delete(key) | ||
return result | ||
@@ -289,3 +289,3 @@ }) | ||
this.onError(err) | ||
this.dedupes.set(key, undefined) | ||
this.dedupes.delete(key) | ||
// TODO option to remove key from storage on error? | ||
@@ -303,3 +303,3 @@ // we may want to relay on cache if the original function got error | ||
const key = this.getKey(value) | ||
this.dedupes.set(key, undefined) | ||
this.dedupes.delete(key) | ||
await this.storage.remove(this.getStorageKey(key)) | ||
@@ -306,0 +306,0 @@ return |
@@ -151,3 +151,3 @@ 'use strict' | ||
test('works with custom serialize', async (t) => { | ||
t.plan(2) | ||
t.plan(3) | ||
@@ -169,2 +169,3 @@ const cache = new Cache({ storage: createStorage() }) | ||
t.same([...cache[kValues].fetchSomething.dedupes.keys()], ['42', '24']) | ||
const res = await Promise.all([p1, p2]) | ||
@@ -177,3 +178,4 @@ | ||
t.same([...cache[kValues].fetchSomething.dedupes.keys()], ['42', '24']) | ||
// Ensure we clean up dedupes | ||
t.same([...cache[kValues].fetchSomething.dedupes.keys()], []) | ||
}) | ||
@@ -180,0 +182,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
145426
3529