Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

async-cache-dedupe

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-cache-dedupe - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

5

package.json
{
"name": "async-cache-dedupe",
"version": "1.2.1",
"version": "1.2.2",
"description": "An async deduping cache",

@@ -8,3 +8,4 @@ "main": "index.js",

"test": "standard | snazzy && tap test/*test.js",
"lint:fix": "standard --fix"
"lint:fix": "standard --fix",
"redis": "docker run --rm -p 6379:6379 redis redis-server"
},

@@ -11,0 +12,0 @@ "repository": {

2

README.md

@@ -179,3 +179,3 @@ # async-cache-dedupe

See [mercurius-cache-example](https://github.com/mercurius/mercurius-cache-example) for a complete example.
See [mercurius-cache-example](https://github.com/mercurius-js/mercurius-cache-example) for a complete example.

@@ -182,0 +182,0 @@ ### Redis

@@ -211,14 +211,18 @@ 'use strict'

add (args) {
const key = this.getKey(args)
try {
const key = this.getKey(args)
let query = this.dedupes.get(key)
if (!query) {
query = new Query()
this.buildPromise(query, args, key)
this.dedupes.set(key, query)
} else {
this.onDedupe(key)
let query = this.dedupes.get(key)
if (!query) {
query = new Query()
this.buildPromise(query, args, key)
this.dedupes.set(key, query)
} else {
this.onDedupe(key)
}
return query.promise
} catch (err) {
this.onError(err)
}
return query.promise
}

@@ -225,0 +229,0 @@

@@ -583,1 +583,16 @@ 'use strict'

})
test('should call onError when serialize throws exception', async (t) => {
t.plan(1)
const serialize = () => {
throw new Error('error serializing')
}
const onError = err => t.equal(err.message, 'error serializing')
const cache = new Cache({ storage: createStorage(), onError })
cache.define('serializeWithError', { serialize }, async k => k)
await cache.serializeWithError(1)
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc