![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
node-redis-scan
Advanced tools
A simple ES6 Redis key scanner for Node 8 and newer. This is a small class that allows you to do one thing quickly and easily: scan a Redis keyspace for a given pattern.
See the Redis SCAN command documentation for information about how to write patterns for matching, the guarantees, caveats, etc.
yarn add node-redis-scan
Instantiate this class with a Node Redis client and then perform keyspace scans in one of two ways...
scan()
methodThe scan()
method provides the easiest way to scan your keyspace with a single callback that will be passed all matching keys. Depending on the size of your keyspace (millions of keys and beyond) this process might take many seconds or longer.
Parameters
Name | Type | Description |
---|---|---|
pattern | string | The Redis glob-style string pattern to match keys against. |
callback | function | Invoked with (err, matchingKeys). |
Example
const redis = require('redis');
const redisScan = require('node-redis-scan');
const client = redis.createClient();
const scanner = new redisScan(client);
scanner.scan('some-pattern*', (err, matchingKeys) => {
if (err) throw(err);
// matchingKeys will be an array of strings if matches were found
// otherwise it will be an empty array.
console.log(matchingKeys);
});
eachScan()
methodThe eachScan()
method is useful if you want to perform work with matched keys at the same time as the keyspace is being scanned. When you’re scanning an enormous keyspace this is likely a more efficient way to operate: you can begin handling matched keys asynchronously, before the scan has finished. Unfortunately this approach doesn’t help in situations where you need to have every matching key prior to performing the next step in your operation/application.
Matching keys are passed to the intermediate callback function after each iteration of the Redis SCAN
command. The final callback is passed a count of how many matching keys were returned.
Parameters
Name | Type | Description |
---|---|---|
pattern | string | The Redis glob-style string pattern to match keys against. |
eachScanCallback | function | Invoked with (matchingKeys). |
callback | function | Invoked with (err, matchCount). |
Example
const redis = require('redis');
const redisScan = require('node-redis-scan');
const client = redis.createClient();
const scanner = new redisScan(client);
scanner.eachScan('some-pattern*', (matchingKeys) => {
// Depending on the pattern being scanned for, many or most calls to
// this function will be passed an empty array.
if (matchingKeys.length) {
// matchingKeys found after this iteration of the SCAN command.
console.log(matchingKeys);
}
}, (err, matchCount) => {
if (err) throw(err);
// matchCount will be an integer count of how many total keys
// were found and passed to the intermediate callback.
console.log(`Found ${matchCount} keys.`);
});
Tests are run via Istanbul and Mocha. Clone the project then run:
yarn test
Simply open an issue or send a pull request. Not sure how to do that? Check out Github’s fast and free course on how to contribute to a project.
Licensed under the Apache License 2.0.
FAQs
A simple ES6 Redis key scanner for Node
The npm package node-redis-scan receives a total of 1,214 weekly downloads. As such, node-redis-scan popularity was classified as popular.
We found that node-redis-scan 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.