
Security News
/Research
Fake Corepack Site Distributes Infostealer and Proxyware to Developers
A fake corepack.org site is impersonating the Node.js tool and delivers an infostealer and proxyware to developers who download it.
secondary-cache
Advanced tools
support secondary cache mechanism. the first level cache is fixed memory-resident always with the highest priority. the second level is the LRU cache.
It can support secondary cache mechanism. the first level cache is fixed memory-resident always with the highest priority. the second level is the LRU cache.
the secondary LRU cache only available set the capacity of options or the key's expires time.
Cache(options|capacity):
'before_add': triggle on a new key before added to cache.'before_update':triggle on a key before updated to cache.'add': triggle on a new key added to cache.'update':triggle on a key updated to cache.'del': triggle on a key removed from cache.LRUCache(options|capacity): the LRU cache Class with expires supports.
'before_add': triggle on a new key before added to cache.'before_update':triggle on a key before updated to cache.'add': triggle on a new key added to cache.'update':triggle on a key updated to cache.'del': triggle on a key removed from cache.LRUQueue(capacity): the LRU queue class for object queue item.
'lu' property of the object queue item.import {Cache, LRUCache} from 'secondary-cache'
cache = new Cache()
// track storage size
cache.maxSize = 0
cache.on('before_add', function(key, value) {
const cache = this.target
if (cache.maxSize > MAX_SIZE) {
cache.clear();
cache.maxSize = 0;
}
cache.maxSize += sizeCalculation(value, key)
})
// clean up when objects are evicted from the cache
cache.on('del', function(key, value){
freeFromMemory(value)
})
cache.set('key', 'value', {fixed:true}) // put it into fixed capacity storage.
cache.get('key')
cache.set('expiresKey', 'value', 1000) // expired after 1 second
//or only use LRU Cache
cache = new LRUCache(1000)
...
add/update key, value to cache.
It will update the "recently used"-ness of the key if LRUCache enabled.
add/update key,value to the first level fixed cache directly.
add/update key,value to the secondary level LRU cache directly.
get the key from cache. it will fetch the key from the first fixed cache, fetch the key from the secondary cache if missing in the first cache.
It will update the "recently used"-ness of the key in the secondary cache if LRUCache enabled.
get the key from the first level fixed cache directly.
get the key from the secondary level LRU cache directly.
get the key from cache. it will fetch the key from the first fixed cache, fetch the key from the secondary cache if missing in the first cache.
It will not update the "recently used"-ness in the secondary cache.
get the key from the secondary LRU cache directly.
It will not update the "recently used"-ness in the secondary cache.
aliases: isExist, isExists
the key whether exists in the cache.
executes a provided function once per each value in the cache. first iterated the fixed cache , and then the LRU cache.
executes a provided function once per each value in the first level fixed cache, in insertion order.
executes a provided function once per each value in the secondary level LRU cache, in order of recent-ness (more recently used items are iterated over first) if LRU is enabled. Or in insertion order.
alias: delete
Deletes a key out of the cache.
Clear the cache entirely and apply the new options.
Clear the cache entirely.
Adds a listener for the specified event.
'add': triggle on a new key added to cache.'update':triggle on a key updated to cache.'del': triggle on a key removed from cache.free the first fixed cache and the secondary LRU cache.
Sets the default options for Cache.
return the number of items in the FixedCache and LRUCache.
FAQs
support secondary cache mechanism. the first level cache is fixed memory-resident always with the highest priority. the second level is the LRU cache.
The npm package secondary-cache receives a total of 30 weekly downloads. As such, secondary-cache popularity was classified as not popular.
We found that secondary-cache demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A fake corepack.org site is impersonating the Node.js tool and delivers an infostealer and proxyware to developers who download it.

Research
/Security News
A large-scale campaign abused GitHub Actions in compromised repositories to exploit CVE-2026-41940 in cPanel and WHM and steal server credentials.

Security News
Five frontier LLMs generated the same nonexistent package names, leaving 53 available for potential slopsquatting across PyPI and npm.