1.6.1 • Published 7 years ago

shimo-redis-scan v1.6.1

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

redis-scan

Scan redis keys with pattern and do something to them, Aliyun redis cluster is supported.

install

npm i shimo-redis-scan

usage

const RedisScan = require('shimo-redis-scan')
const Ioredis = require('ioredis')

// All keys is optional
const task = new RedisScan({
  // pattern
  pattern: 'key:*',
  // redis client
  redis: new Ioredis(),
  // scan count per time
  size: 1000,
  // handler function which return promise
  handler: function ({ key, index, stop, clusterIndex }) {
    console.log('current index:', index)
    if (index > 10000) {
      stop()
    }
  },
  // aliyun redis cluster
  aliyun: false
})

task.start().then(() => process.exit(0))

notes

  1. You need to make your own catch-error logic
  2. Your node.js version must support async function
  3. Cluster mode is only enabled in Aliyun redis cluster

License

MIT

1.6.1

7 years ago

1.6.0

7 years ago

1.5.0

7 years ago

0.0.2

7 years ago

1.4.0

7 years ago

0.0.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago