Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
memoize-cache
Advanced tools
A configurable cache support for memoized functions. It is lightweight so it can run in the browser without any problem.
This is an in-memory cache implementation. But the interface is designed to work with an external storage support (db, etc). The only 2 required public methods are: "push" and "query".
The constructor takes an option object with 3 optional attributes:
Example:
var Cache = require('memoize-cache/ram-cache'); // or require('memoize-cache').ramCache;
// no values, uses always the same key for store any value
var cache = new Cache();
// using the id property of the first argument
// this cache will store maximum 100 items
// every item will be considered stale and purged after 20 seconds.
var cache = new Cache({key: function (config){
return config.id;
}}, maxLen: 100, maxAge: 20000);
cache.push(args, output);
"args" is an array containing the arguments passed to the function that generated the output.
cache.query(args, function (err, result){
// result.cached is true when you find a cached value
// result.hit is the value cached
// cached.key is the key used to store the value (might be useful for debugging)
});
"args" is an array containing the arguments passed to the function that generated the output.
cache.reset();
cache.len();
cache.size(true); // size is an human readable size
cache.size(false); // size is expressed in byte
If the first argument is true the output will be pretty printed.
FAQs
A cache support for memoized functions
The npm package memoize-cache receives a total of 53 weekly downloads. As such, memoize-cache popularity was classified as not popular.
We found that memoize-cache 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.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.