Research
Recent Trends in Malicious Packages Targeting Discord
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
cachd
Advanced tools
Readme
A fast TTL Cache
for node >= 4.2
About the memory mangement:
The cache stops caching more items if the memory is getting full (> 70% of the heap used). It accepts new items but removes the oldest ones before the ttl or max size is reached.
Create cache instance
var Cachd = require('cachd');
var myCache = new Cachd({
ttl: 3600000 // max age of items in msec (default: 3600000 -> 1h)
, maxLength: 1000 // the maximum of items to store (default: 10000)
, removalStrategy: 'leastUsed' // remove the least used items if the cache is getting
// too full (default: oldest)
});
Add item. You have to pass a unique hash and the value.
myCache.set(hash, value);
// alias of set
myCache.add(hash, value);
Check if an item exists
if (myCache.has(hash)) {
// there it is ;)
}
Get an item
var item = myCache.get(hash);
Remove an item
myCache.remove(hash);
Get all hashes
var hashMap = myCache.getHashMap();
Get first cached item. This is the most accessed item if the cache has the «leastUsed» removal strategy, else its the most recent added item.
var item = mycache.getFirst();
Get last cached item. This is the least accessed item if the cache has the «leastUsed» removal strategy, else its the least recent added item.
var item = mycache.getFirst();
the cache emits events when an item is added or one is removed
myCache.on('add', function(hash, value) {
});
myCache.on('remove', function(hash, value) {
});
FAQs
A fast TTL Cache implementation
We found that cachd 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
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Security News
Socket CEO Feross Aboukhadijeh joins a16z partners to discuss how modern, sophisticated supply chain attacks require AI-driven defenses and explore the challenges and solutions in leveraging AI for threat detection early in the development life cycle.
Security News
NIST's new AI Risk Management Framework aims to enhance the security and reliability of generative AI systems and address the unique challenges of malicious AI exploits.