Socket
Socket
Sign inDemoInstall

lru-cache-for-clusters-as-promised

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lru-cache-for-clusters-as-promised - npm Package Compare versions

Comparing version 1.5.16 to 1.5.17

.DS_Store

20

lru-cache-for-clusters-as-promised.js

@@ -55,3 +55,3 @@ /**

Promise.all(
Object.keys(pairs).map((key) => Promise.resolve((objs[key] = JSON[jsonFunction](pairs[key]))))
Object.keys(pairs).map((key) => Promise.resolve((objs[key] = JSON[jsonFunction](pairs[key]))))
),

@@ -341,7 +341,7 @@ mDel: (lru, params) => {

promiseTo('()', options)
.then((lruOptions) => debug('created lru cache on master', lruOptions))
.catch((err) => {
/* istanbul ignore next */
debug('failed to create lru cache on master', err, options);
});
.then((lruOptions) => debug('created lru cache on master', lruOptions))
.catch((err) => {
/* istanbul ignore next */
debug('failed to create lru cache on master', err, options);
});
}

@@ -363,4 +363,4 @@

return funcs
.mapObjects(pairs, objs, 'parse')
.then(() => Promise.resolve(objs));
.mapObjects(pairs, objs, 'parse')
.then(() => Promise.resolve(objs));
}),

@@ -370,4 +370,4 @@ mSetObjects: (pairs, maxAge) => {

return funcs
.mapObjects(pairs, objs, 'stringify')
.then(() => promiseTo('mSet', objs, maxAge));
.mapObjects(pairs, objs, 'stringify')
.then(() => promiseTo('mSet', objs, maxAge));
},

@@ -374,0 +374,0 @@ mDel: (keys) => promiseTo('mDel', keys),

{
"name": "lru-cache-for-clusters-as-promised",
"version": "1.5.16",
"version": "1.5.17",
"description": "LRU Cache that is safe for clusters",

@@ -35,20 +35,20 @@ "main": "./lru-cache-for-clusters-as-promised.js",

"dependencies": {
"cron": "1.3.0",
"debug": "3.1.0",
"lru-cache": "4.1.1",
"uuid": "3.1.0"
"cron": "1.7.0",
"debug": "4.1.1",
"lru-cache": "5.1.1",
"uuid": "3.3.2"
},
"devDependencies": {
"depcheck": "0.6.8",
"eslint": "4.11.0",
"eslint-config-google": "0.9.1",
"eslint-plugin-mocha": "4.11.0",
"express": "4.16.2",
"depcheck": "0.7.2",
"eslint": "5.15.3",
"eslint-config-google": "0.12.0",
"eslint-plugin-mocha": "5.3.0",
"express": "4.16.4",
"istanbul": "0.4.5",
"istanbul-cobertura-badger": "1.3.1",
"mocha": "4.0.1",
"should": "13.1.3",
"sloc": "0.2.0",
"mocha": "6.0.2",
"should": "13.2.3",
"sloc": "0.2.1",
"spec-xunit-file": "0.0.1-3",
"supertest": "3.0.0"
"supertest": "4.0.2"
},

@@ -55,0 +55,0 @@ "pre-commit": [

@@ -17,9 +17,9 @@ const request = require('supertest');

request(`http://${config.server.host}:${config.server.port}`)
.get('/reset')
.end((err) => {
if (err) {
return done(err);
}
return done();
});
.get('/reset')
.end((err) => {
if (err) {
return done(err);
}
return done();
});
});

@@ -32,10 +32,10 @@

request(`http://${config.server.host}:${config.server.port}`)
.get(`/${method}`)
.expect(200)
.end((err, response) => {
if (err) {
return done(err);
}
return response.body === true ? done() : done(new Error(response.body));
});
.get(`/${method}`)
.expect(200)
.end((err, response) => {
if (err) {
return done(err);
}
return response.body === true ? done() : done(new Error(response.body));
});
});

@@ -42,0 +42,0 @@ });

@@ -28,3 +28,3 @@ const cluster = require('cluster');

// append any additional command line arguments
.concat(process.argv.slice(2)),
.concat(process.argv.slice(2)),
});

@@ -75,3 +75,3 @@ } else {

cache.keys()
.then(() => done2());
.then(() => done2());
},

@@ -78,0 +78,0 @@ getCacheMax: () => {

@@ -62,8 +62,8 @@ const config = require('./config');

cache.mSet(pairs)
.then(() => cache.get('bizz'))
.then((value) => {
should(value).equal('buzz');
cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.get('bizz'))
.then((value) => {
should(value).equal('buzz');
cb(null, true);
})
.catch((err) => cb(err));
},

@@ -73,8 +73,8 @@ mSetNull: (cb) => {

cache.mSet(pairs)
.then(() => cache.mSet('string'))
.then(() => cache.mSet(['array']))
.then(() => {
cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.mSet('string'))
.then(() => cache.mSet(['array']))
.then(() => {
cb(null, true);
})
.catch((err) => cb(err));
},

@@ -87,10 +87,10 @@ mGet: (cb) => {

cache.mSet(pairs)
.then(() => cache.mGet(['bizz', 'foo']))
.then((values) => {
// should(values).not.equal(undefined);
should(values.bizz).equal('buzz');
should(values.foo).equal('bar');
cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.mGet(['bizz', 'foo']))
.then((values) => {
// should(values).not.equal(undefined);
should(values.bizz).equal('buzz');
should(values.foo).equal('bar');
cb(null, true);
})
.catch((err) => cb(err));
},

@@ -103,21 +103,21 @@ mGetAndSetObjects: (cb) => {

cache.mSetObjects(pairs)
.then(() => cache.mGetObjects(['bizz', 'foo']))
.then((values) => {
should(values.bizz).deepEqual({ bam: 'buzz' });
should(values.foo).deepEqual({ boo: 'bar' });
cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.mGetObjects(['bizz', 'foo']))
.then((values) => {
should(values.bizz).deepEqual({ bam: 'buzz' });
should(values.foo).deepEqual({ boo: 'bar' });
cb(null, true);
})
.catch((err) => cb(err));
},
mGetNull: (cb) => {
cache.mGet('string')
.then((values) => {
should(values).deepEqual({});
return cache.mGet(null);
})
.then((values) => {
should(values).deepEqual({});
cb(null, true);
})
.catch((err) => cb(err));
.then((values) => {
should(values).deepEqual({});
return cache.mGet(null);
})
.then((values) => {
should(values).deepEqual({});
cb(null, true);
})
.catch((err) => cb(err));
},

@@ -130,9 +130,9 @@ mDel: (cb) => {

cache.mSet(pairs)
.then(() => cache.mDel(['my', 'get']))
.then(() => cache.get('get'))
.then((value) => {
should(value).equal(undefined);
cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.mDel(['my', 'get']))
.then(() => cache.get('get'))
.then((value) => {
should(value).equal(undefined);
cb(null, true);
})
.catch((err) => cb(err));
},

@@ -145,9 +145,9 @@ mDelNull: (cb) => {

cache.mSet(pairs)
.then(() => cache.mDel(null))
.then(() => cache.get('bizz'))
.then((value) => {
should(value).equal('blamo');
cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.mDel(null))
.then(() => cache.get('bizz'))
.then((value) => {
should(value).equal('blamo');
cb(null, true);
})
.catch((err) => cb(err));
},

@@ -157,18 +157,18 @@ objects: (cb) => {

cache.setObject(1, myObj)
.then(() => cache.getObject(1))
.then((obj) => {
should(obj).not.equal(null);
should(obj.foo).equal('bar');
cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.getObject(1))
.then((obj) => {
should(obj).not.equal(null);
should(obj.foo).equal('bar');
cb(null, true);
})
.catch((err) => cb(err));
},
null_objects: (cb) => {
cache.setObject(1, undefined)
.then(() => cache.getObject(1))
.then((obj) => {
should(obj).equal(undefined);
cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.getObject(1))
.then((obj) => {
should(obj).equal(undefined);
cb(null, true);
})
.catch((err) => cb(err));
},

@@ -199,4 +199,4 @@ hi: (cb) => {

return cacheBad.get(`bad-cache-key-${large}`)
.then((result) => cb(null, result))
.catch((err) => cb(err));
.then((result) => cb(null, result))
.catch((err) => cb(err));
},

@@ -216,4 +216,4 @@ reject: (cb) => {

return cacheBad.get(`bad-cache-key-${large}`)
.then(() => cb('fail'))
.catch(() => cb(null, true));
.then(() => cb('fail'))
.catch(() => cb(null, true));
},

@@ -229,57 +229,57 @@ pruneJob: (cb) => {

prunedCache.set(config.args.one, config.args.one)
.then(() => prunedCache.set(config.args.two, config.args.two, 2000))
.then(() => prunedCache.itemCount())
.then((itemCount) => {
// we should see 2 items in the cache
should(itemCount).equal(2);
// check again in 1100 ms
setTimeout(() => {
// one of the items should have been removed based on the expiration
prunedCache.itemCount()
.then((itemCount2) => {
try {
should(itemCount2).equal(1);
return cb(null, true);
} catch (err) {
return cb(err);
}
});
}, 1100);
})
.catch((err) => cb(err));
.then(() => prunedCache.set(config.args.two, config.args.two, 2000))
.then(() => prunedCache.itemCount())
.then((itemCount) => {
// we should see 2 items in the cache
should(itemCount).equal(2);
// check again in 1100 ms
setTimeout(() => {
// one of the items should have been removed based on the expiration
prunedCache.itemCount()
.then((itemCount2) => {
try {
should(itemCount2).equal(1);
return cb(null, true);
} catch (err) {
return cb(err);
}
});
}, 1100);
})
.catch((err) => cb(err));
},
set: (cb) => {
cache.set(config.args.one, config.args.one)
.then((result) => cb(null, result))
.catch((err) => cb(err));
.then((result) => cb(null, result))
.catch((err) => cb(err));
},
get: (cb) => {
cache.set(config.args.one, config.args.one)
.then(() => cache.get(config.args.one))
.then((result) => {
should(result).equal(config.args.one);
return cb(null, result);
})
.catch((err) => cb(err));
.then(() => cache.get(config.args.one))
.then((result) => {
should(result).equal(config.args.one);
return cb(null, result);
})
.catch((err) => cb(err));
},
del: (cb) => {
cache.del(config.args.one)
.then(() => cache.get(config.args.one))
.then((result) => {
should(result).equal(undefined);
return cb(null, result);
})
.catch((err) => cb(err));
.then(() => cache.get(config.args.one))
.then((result) => {
should(result).equal(undefined);
return cb(null, result);
})
.catch((err) => cb(err));
},
incr: (cb) => {
cache.incr(config.args.one)
.then((value) => {
should(value).eql(1);
return cache.incr(config.args.one);
})
.then((value) => {
should(value).eql(2);
return cb(null, true);
})
.catch((err) => cb(err));
.then((value) => {
should(value).eql(1);
return cache.incr(config.args.one);
})
.then((value) => {
should(value).eql(2);
return cb(null, true);
})
.catch((err) => cb(err));
},

@@ -289,23 +289,23 @@ incr2: (cb) => {

cache.incr(config.args.one, amount)
.then((value) => {
should(value).eql(2);
return cache.incr(config.args.one, amount);
})
.then((value) => {
should(value).eql(4);
return cb(null, true);
})
.catch((err) => cb(err));
.then((value) => {
should(value).eql(2);
return cache.incr(config.args.one, amount);
})
.then((value) => {
should(value).eql(4);
return cb(null, true);
})
.catch((err) => cb(err));
},
decr: (cb) => {
cache.decr(config.args.one)
.then((value) => {
should(value).eql(-1);
return cache.decr(config.args.one);
})
.then((value) => {
should(value).eql(-2);
return cb(null, true);
})
.catch((err) => cb(err));
.then((value) => {
should(value).eql(-1);
return cache.decr(config.args.one);
})
.then((value) => {
should(value).eql(-2);
return cb(null, true);
})
.catch((err) => cb(err));
},

@@ -315,198 +315,198 @@ decr2: (cb) => {

cache.decr(config.args.one, amount)
.then((value) => {
should(value).eql(-2);
return cache.decr(config.args.one, amount);
})
.then((value) => {
should(value).eql(-4);
return cb(null, true);
})
.catch((err) => cb(err));
.then((value) => {
should(value).eql(-2);
return cache.decr(config.args.one, amount);
})
.then((value) => {
should(value).eql(-4);
return cb(null, true);
})
.catch((err) => cb(err));
},
peek: (cb) => {
cache.set(config.args.one, config.args.one)
.then(() => cache.set(config.args.two, config.args.two))
.then(() => cache.set(config.args.three, config.args.three))
.then(() => cache.peek(config.args.one))
.then((result) => {
should(result).equal(config.args.one);
return cache.set(config.args.four, config.args.four);
})
.then(() => cache.get(config.args.one))
.then((result) => {
should(undefined).equal(result);
return cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.set(config.args.two, config.args.two))
.then(() => cache.set(config.args.three, config.args.three))
.then(() => cache.peek(config.args.one))
.then((result) => {
should(result).equal(config.args.one);
return cache.set(config.args.four, config.args.four);
})
.then(() => cache.get(config.args.one))
.then((result) => {
should(undefined).equal(result);
return cb(null, true);
})
.catch((err) => cb(err));
},
has: (cb) => {
cache.set(config.args.one, config.args.one)
.then(() => cache.has(config.args.one))
.then((has) => {
should(has).equal(true);
return cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.has(config.args.one))
.then((has) => {
should(has).equal(true);
return cb(null, true);
})
.catch((err) => cb(err));
},
length: (cb) => {
cache.set(config.args.two, config.args.two)
.then(() => cache.set(config.args.three, config.args.three))
.then(() => cache.length())
.then((length) => {
should(length).equal(2);
return cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.set(config.args.three, config.args.three))
.then(() => cache.length())
.then((length) => {
should(length).equal(2);
return cb(null, true);
})
.catch((err) => cb(err));
},
itemCount: (cb) => {
cache.set(config.args.one, config.args.one)
.then(() => cache.itemCount())
.then((itemCount) => {
should(itemCount).equal(1);
return cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.itemCount())
.then((itemCount) => {
should(itemCount).equal(1);
return cb(null, true);
})
.catch((err) => cb(err));
},
reset: (cb) => {
cache.set(config.args.one, config.args.one)
.then(() => cache.reset())
.then(() => cache.get(config.args.one))
.then((result) => {
should(result).equal(undefined);
return cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.reset())
.then(() => cache.get(config.args.one))
.then((result) => {
should(result).equal(undefined);
return cb(null, true);
})
.catch((err) => cb(err));
},
keys: (cb) => {
cache.set(config.args.one, config.args.one)
.then((result) => {
should(result).equal(true);
return cache.keys();
})
.then((keys) => {
should(keys.length).equal(1);
should(keys[0]).equal(config.args.one);
return cb(null, true);
})
.catch((err) => cb(err));
.then((result) => {
should(result).equal(true);
return cache.keys();
})
.then((keys) => {
should(keys.length).equal(1);
should(keys[0]).equal(config.args.one);
return cb(null, true);
})
.catch((err) => cb(err));
},
values: (cb) => {
cache.set(config.args.two, config.args.two)
.then(() => cache.values())
.then((values) => {
should(values).deepEqual([config.args.two]);
return cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.values())
.then((values) => {
should(values).deepEqual([config.args.two]);
return cb(null, true);
})
.catch((err) => cb(err));
},
prune: (cb) => {
cache.set(config.args.one, config.args.one)
.then(() => cache.prune())
.then(() => cache.itemCount())
.then((itemCount) => {
should(itemCount).equal(1);
return cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.prune())
.then(() => cache.itemCount())
.then((itemCount) => {
should(itemCount).equal(1);
return cb(null, true);
})
.catch((err) => cb(err));
},
dump: (cb) => {
cache.set(config.args.one, config.args.two)
.then(() => cache.dump())
.then((dump) => {
should(dump[0].k).equal(config.args.one);
should(dump[0].v).equal(config.args.two);
return cb(null, true);
})
.catch((err) => cb(err));
.then(() => cache.dump())
.then((dump) => {
should(dump[0].k).equal(config.args.one);
should(dump[0].v).equal(config.args.two);
return cb(null, true);
})
.catch((err) => cb(err));
},
getMax: (cb) => {
cache.max()
.then((max) => {
should(max).equal(3);
return cb(null, true);
})
.catch((err) => cb(err));
.then((max) => {
should(max).equal(3);
return cb(null, true);
})
.catch((err) => cb(err));
},
getMaxAge: (cb) => {
cache.maxAge()
.then((maxAge) => {
should(maxAge).equal(0);
return cb(null, true);
})
.catch((err) => cb(err));
.then((maxAge) => {
should(maxAge).equal(0);
return cb(null, true);
})
.catch((err) => cb(err));
},
getStale: (cb) => {
cache.stale()
.then((stale) => {
should(stale).equal(undefined);
return cb(null, true);
})
.catch((err) => cb(err));
.then((stale) => {
should(stale).equal(undefined);
return cb(null, true);
})
.catch((err) => cb(err));
},
setMax: (cb) => {
cache.max(100)
.then((max) => {
should(max).equal(100);
return cb(null, true);
})
.catch((err) => cb(err));
.then((max) => {
should(max).equal(100);
return cb(null, true);
})
.catch((err) => cb(err));
},
setMaxAge: (cb) => {
cache.maxAge(10)
.then((maxAge) => {
should(maxAge).equal(10);
return cb(null, true);
})
.catch((err) => cb(err));
.then((maxAge) => {
should(maxAge).equal(10);
return cb(null, true);
})
.catch((err) => cb(err));
},
setStale: (cb) => {
cache.stale(true)
.then((stale) => {
should(stale).equal(true);
return cb(null, true);
})
.catch((err) => cb(err));
.then((stale) => {
should(stale).equal(true);
return cb(null, true);
})
.catch((err) => cb(err));
},
addFour: (cb) => {
cache.set(config.args.one, config.args.one)
.then((value) => {
should(value).equal(true);
return cache.set(config.args.two, config.args.two);
})
.then(() => cache.set(config.args.three, config.args.three))
.then(() => cache.set(config.args.four, config.args.four))
.then(() => cache.get(config.args.one))
.then((result) => {
should(result).equal(undefined);
return cb(null, true);
})
.catch((err) => cb(err));
.then((value) => {
should(value).equal(true);
return cache.set(config.args.two, config.args.two);
})
.then(() => cache.set(config.args.three, config.args.three))
.then(() => cache.set(config.args.four, config.args.four))
.then(() => cache.get(config.args.one))
.then((result) => {
should(result).equal(undefined);
return cb(null, true);
})
.catch((err) => cb(err));
},
addFourAccessOne: (cb) => {
cache.set(config.args.one, config.args.one)
.then((value) => {
should(value).equal(true);
return cache.set(config.args.two, config.args.two);
})
.then((value) => {
should(value).equal(true);
return cache.set(config.args.three, config.args.three);
})
.then((value) => {
should(value).equal(true);
return cache.get(config.args.one);
})
.then((value) => {
should(value).equal(config.args.one);
return cache.set(config.args.four, config.args.four);
})
.then((value) => {
should(value).equal(true);
return cache.get(config.args.one);
})
.then((result) => {
should(result).equal(config.args.one);
return cb(null, true);
})
.catch((err) => cb(err));
.then((value) => {
should(value).equal(true);
return cache.set(config.args.two, config.args.two);
})
.then((value) => {
should(value).equal(true);
return cache.set(config.args.three, config.args.three);
})
.then((value) => {
should(value).equal(true);
return cache.get(config.args.one);
})
.then((value) => {
should(value).equal(config.args.one);
return cache.set(config.args.four, config.args.four);
})
.then((value) => {
should(value).equal(true);
return cache.get(config.args.one);
})
.then((result) => {
should(result).equal(config.args.one);
return cb(null, true);
})
.catch((err) => cb(err));
},

@@ -513,0 +513,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