
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
lrucache-nodejs
Advanced tools
A least recently used (LRU) cache is a cache implementation that discards the least recently used item when the cache becomes full. This requires keeping track of what was used when, and becomes the crux of maintaining an O(1) time complexity.
When an item is read from the cache (or added), it is marked as the most recently used item, and all other items get "shifted" over one. If the queue is full, the last item gets removed (shifted off). The key to this is using a linked list to rearrange the elements, and a map to store everything.
lrucache-nodejs is plain javascript runs on browser and nodejs
via npm
$ npm install lrucache-nodejs --save
Import the library:
const LRUCache = require('lrucache-nodejs').Cache
const cache = new LRUCache([cacheSize = 10]);
// return an item from the cache
cache.get(key)
// add an item to the cache. overwrite if already exists
cache.set(key, value)
// remove an item from the cache
cache.remove(key)
// reset the cache to an empty and fresh state
cache.clear(limit = 10)
// Traverse each cached item and call a function
// callback is passed [node element, element number, cache instance]
cache.forEach(callback)
// return a JSON represenation of the cache
cache.toJSON()
$ npm test
(optional) Import the Node:
const LRUCache = require('lrucache-nodejs').Node
See LRU Cache wiki
😎
FAQs
LRU (Recently Used Cache) Cache for node.js or Browser
We found that lrucache-nodejs 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.