
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
async-data-cache
Advanced tools
<img src=https://img.shields.io/npm/l/async-data-cache> <img src=https://img.shields.io/snyk/vulnerabilities/github/emiliosp/async-data-cache> <img src=https://img.shields.io/npm/v/async-data-cache> <img src=https://img.shields.io/badge/keyword-performance-blue> <img src=https://img.shields.io/badge/keyword-cache-blue>
A simple async data cache with no dependencies.
This library allows your to cache the result of an async call.
It's useful when you have to call an api or execute a heavy query and the performance are more important than the real-time. You can easily choose the cache time to live (ttl).
yarn add async-data-cache
// Simulate a function that requires 3 secs to complete (e.g. a heavy db query)
const dataFetcher = (): Promise<Array<number>> => {
console.log('dataFetcher');
return new Promise((res, rej) => {
setTimeout(() => res([1, 2, 3, 4, 5]), 3000);
})
}
(async () => {
// With the cache the dataFetcher function will be called only 1 time.
const cache = new DataCache<Array<number>>(dataFetcher);
let data = await cache.getData();
console.log(data);
data = await cache.getData();
console.log(data);
data = await cache.getData();
console.log(data);
data = await cache.getData();
console.log(data);
})();
To change the ttl, pass the ttl minutes to the DataCache constructor
// 1 hour of ttl
const cache = new DataCache<Array<number>>(dataFetcher, 60);
FAQs
Node.js cache for async data
The npm package async-data-cache receives a total of 9 weekly downloads. As such, async-data-cache popularity was classified as not popular.
We found that async-data-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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.