
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
raptor-cache
Advanced tools
Efficient JavaScript cache implementation that is safe for concurrent reads and writes
This module provides a caching layer that supports asynchronous reading and writing and it prevents duplicate work from being done by allowing a "hold" to be put on a cache entry. A common pattern when utilizing a cache is to read from the cache and to then build the cached value if it was not found in the cache. By putting a hold on a cache entry while its value is being built asynchronously, this caching layer can ensure that a value for a particular key is only built once by the current process. This module solves the challenges of working with asynchronous cache stores and provides out-of-box support for an in-memory cache and a disk-based cache. It is possible to provide a custom cache store that connects to a centralized cache such as Redis or memcached.
npm install raptor-cache --save
var raptorCache = require('raptor-cache');
var cache = raptorCache.createCache({
store: 'disk',
timeToLive: 10000, // Permanently remove a cache entry after 10s (regardless of usage)
timeToIdle: 7000, // Permanently remove a cache entry that has not been accessed for 7s
freeDelay: 5000, // Free all memory after 5s of inactivity
// Disk store specific config:
dir: '.cache/my-cache',
flushDelay: 1000, // Commit cached values to disk after 1s of no write activity
encoding: 'utf8'
});
cache.get(
'hello', // key
function builder(callback) { // This function will be called if the value has not been cached
setTimeout(function() {
// Respond back with the value to put in the cache
callback(null, 'world');
}, 1000)
},
function callback(err, value) {
// value === 'world'
});
// Request a stream to read a value:
cache.getReadStream(
'hello', // key
function callback(err, stream) {
stream.pipe(process.stdin); // pipes out 'world'
// NOTE: Stream will be null if nothing was cached for key
});
Characteristics:
var raptorCache = require('raptor-cache');
var cache = raptorCache.createMemoryCache({
...
});
Characteristics:
NOTES:
Configuration options:
var raptorCache = require('raptor-cache');
var cache = raptorCache.createDiskCache({
dir: 'some/directory',
singleFile: true,
flushDelay: 1000,
...
});
Characteristics:
Configuration options:
var raptorCache = require('raptor-cache');
var cache = raptorCache.createDiskCache({
dir: 'some/directory',
singleFile: false,
flushDelay: 1000,
...
});
Characteristics:
Configuration options:
var raptorCache = require('raptor-cache');
var cache = raptorCache.createCompositeCache({
caches: [
raptorCache.createMemoryCache(...),
raptorCache.createDiskCache(...),
...
]
});
FAQs
Efficient JavaScript cache implementation that is safe for concurrent reads and writes
The npm package raptor-cache receives a total of 2,116 weekly downloads. As such, raptor-cache popularity was classified as popular.
We found that raptor-cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.