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

dobi-cache-2

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dobi-cache-2 - npm Package Compare versions

Comparing version 3.0.3 to 3.0.4

17

lib/cache.js

@@ -32,2 +32,13 @@ /* eslint-disable no-process-env */

async flushCache() {
const keys = this.redis.keys('dobiCache:*');
for (const key of keys) {
await this.delete(key);
}
}
static getKey(key) {
return `dobiCache:${key}`;
}
async delete(key) {

@@ -37,3 +48,3 @@ if (this.disabled) {

}
return this.redis.del(key);
return this.redis.del(Cache.getKey(key));
}

@@ -46,3 +57,3 @@

try {
const { type, value } = await this.redis.get(key);
const { type, value } = await this.redis.get(Cache.getKey(key));
if (type === 'object') {

@@ -76,3 +87,3 @@ return JSON.parse(value);

}
await this.redis.set(key, JSON.stringify({ type, value }));
await this.redis.set(Cache.getKey(key), JSON.stringify({ type, value }));
await this.redis.expire(key, ttl);

@@ -79,0 +90,0 @@ }

@@ -8,3 +8,5 @@ 'use strict';

module.exports = ({ config, fn, options }) => asyncWrapper(async (req, res) => {
let flushCache = async () => {};
const middleware = ({ config, fn, options }) => asyncWrapper(async (req, res) => {
const fetch = (callback) => {

@@ -43,2 +45,5 @@ const cb = value => callback(null, value);

await cache.connect();
if (!cache.disabled) {
({ flushCache } = cache);
}

@@ -111,1 +116,6 @@

});
module.exports = {
flushCache,
middleware,
};

2

package.json

@@ -27,3 +27,3 @@ {

},
"version": "3.0.3",
"version": "3.0.4",
"devDependencies": {

@@ -30,0 +30,0 @@ "eslint": "^5.5.0",

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