New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

exp-asynccache

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exp-asynccache - npm Package Compare versions

Comparing version

to
1.2.1

80

index.js

@@ -22,2 +22,78 @@ "use strict";

AsyncCache.prototype.get = function (key, callback) {
return Promise.resolve(this.cache.get(key)).then(function (data) {
if (typeof callback === "function") {
callback(null, data);
}
return data;
}, function (err) {
if (typeof callback === "function") {
callback(err);
} else {
throw err;
}
});
};
AsyncCache.prototype.has = function (key, callback) {
return Promise.resolve(this.cache.has(key)).then(function (exists) {
if (typeof callback === "function") {
callback(null, exists);
}
return exists;
}, function (err) {
if (typeof callback === "function") {
callback(err);
} else {
throw err;
}
});
};
AsyncCache.prototype.set = function (key, value, maxAge, callback) {
if (typeof maxAge === "function") {
callback = maxAge;
maxAge = null;
}
return Promise.resolve(this.cache.set(key, value, maxAge)).then(function () {
if (typeof callback === "function") {
callback();
}
}, function (err) {
if (typeof callback === "function") {
callback(err);
} else {
throw err;
}
});
};
AsyncCache.prototype.del = function (key, callback) {
return Promise.resolve(this.cache.del(key)).then(function () {
if (typeof callback === "function") {
callback();
}
}, function (err) {
if (typeof callback === "function") {
callback(err);
} else {
throw err;
}
});
};
AsyncCache.prototype.reset = function (callback) {
return Promise.resolve(this.cache.reset()).then(function () {
if (typeof callback === "function") {
callback();
}
}, function (err) {
if (typeof callback === "function") {
callback(err);
} else {
throw err;
}
});
};
AsyncCache.prototype.lookup = function (key, resolveFn, hitFn) {

@@ -30,4 +106,4 @@ var self = this;

function set() {
return Promise.resolve(self.cache.set.apply(self.cache, arguments));
function set(key, value, maxAge) {
return Promise.resolve(self.cache.set(key, value, maxAge));
}

@@ -34,0 +110,0 @@

2

package.json
{
"name": "exp-asynccache",
"description": " A small async cache",
"version": "1.2.0",
"version": "1.2.1",
"author": "AB Kvällstidningen Expressen",

@@ -6,0 +6,0 @@ "contributors": [