Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redisscan

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redisscan

Scan through all redis keys and containers, calling back each value individually.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

RedisScan

Recursively scans the keyspace of a Redis 2.8+ instance using SCAN, HSCAN, ZSCAN, & SSCAN as well as Lists.

Fairly safe in a production environment as it does NOT use KEYS * to iterate.

Optionally pass a redis pattern to filter from.

Install

npm install redisscan

Example

var redisScan = require('redisscan');
var redis     = require('redis').createClient();


redisScan({
    redis: redis,
    pattern: 'awesome:key:prefix:*',
    keys_only: false,
    each_callback: function (type, key, subkey, length, value, cb) {
        console.log(type, key, subkey, length, value);
        cb();
    },
    done_callback: function (err) {
        console.log("-=-=-=-=-=--=-=-=-");
        redis.quit();
    }
});

redisScan(parameters):

  • redis: required node-redis client instance
  • pattern: optional wildcard key pattern to match, e.g: some:key:pattern:* docs
  • keys_only: optional boolean -- returns nothing but keys, no types,lengths,values etc. (defaults to false)
  • count_amt: optional positive/non-zero integer -- redis hint for work done per SCAN operation (defaults to 10) docs
  • each_callback: required function (type, key, subkey, length, value, next) This is called for every string, and every subkey/value in a container when not using keys_only, so outer keys may show up multiple times.
    • type may be "string", "hash", "set", "zset", "list"
    • key is the redis key
    • subkey may be null or populated with a hash key
    • length is the length of a set or list
    • value is the value of the key or subkey when appropriate
    • next() should be called as a function with no arguments if successful or an Error object if not.
  • done_callback: optional function called when scanning completes with one argument, and Error object if an error ws raised

Note/Warning

If values are changing, there is no guarantee on value integrity. This is not atomic. I recommend using a lock pattern with this function.

License MIT (c) 2014 Nathanael C. Fritz

FAQs

Package last updated on 07 Apr 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc