Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Goldfish - the forgetful in-memory cache
// _, _,
// .' ( .-' /
// _/..._'. .' /
// .-'` ` '-./ _.'
// ( o) ;= <_
// '-.,\\__ __.-;`\ '.
// \) |`\ \) '. \
// \_/ jgs '-._\
// `
Goldfish({
populate: // fn(arg1, arg2, ..., cb)
expires: // (optional) Integer - miliseconds before a cache item is expired (default = Infinity)
remind: // (optional) Boolean - refresh expire time on fetch (default = false)
capacity: // (optional) Integer - max number of items to have in the cache (default = Infinity)
});
var redisClient = require('redis').createClient()
, Goldfish = require('goldfish')
, cache
;
cache = new Goldfish({
// the populate function will be run when a value does not yet exist in the cache
populate: function(key, cb) {
redisClient.get(key, cb);
},
capacity: 1000, // keep at max 1000 items in the cache
expires: 9001 // evict items that are older than 9001 ms
});
// get value from cache, because 'test' isn't populated, run the populate function
cache.get('test', function(err, result) {
if (err) return console.error(err);
return console.log(result);
});
// listen for any evictions
cache.on('evict', function(entry) {
console.log(entry.args); // Array - the args passed to populate resulting in this entry
console.log(evict.result); // Array - the results from populate
});
// clear the cache
cache.clear();
get#hit O(1)
get#miss O(1) + Populate()
clear O(n)
Complete disregard for the previous api. Don't blindly update.
Smaller, simpler api.
FAQs
Evented in-memory cache
The npm package goldfish receives a total of 4 weekly downloads. As such, goldfish popularity was classified as not popular.
We found that goldfish demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.