# shimo-redis-scan

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

Latest version **1.6.1** (published 2017-09-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install shimo-redis-scan
pnpm add shimo-redis-scan
yarn add shimo-redis-scan
bun add shimo-redis-scan
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.1 |
| Published | 2017-09-28 |
| First published | 2017-09-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | tomwan |

## Links

- npm: https://www.npmjs.com/package/shimo-redis-scan
- Repository: https://github.com/wanming/redis-scan
- Homepage: https://github.com/wanming/redis-scan#readme
- Issues: https://github.com/wanming/redis-scan/issues
- npm.io page: https://npm.io/package/shimo-redis-scan

## Dependencies (2)

- [ioredis](https://npm.io/package/ioredis.md) ^3.1.4
- [pretty-ms](https://npm.io/package/pretty-ms.md) ^3.0.0

## Recent versions

- 1.6.1 (latest) — 2017-09-28
- 1.6.0 — 2017-09-21
- 1.5.0 — 2017-09-21
- 0.0.2 — 2017-09-21
- 1.4.0 — 2017-09-21
- 0.0.1 — 2017-09-21
- 1.3.0 — 2017-09-21
- 1.2.0 — 2017-09-21
- 1.1.0 — 2017-09-21
- 1.0.0 — 2017-09-21

## README

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

## install
```
npm i shimo-redis-scan
```

## usage

```javascript
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

---
_Source: https://npm.io/package/shimo-redis-scan · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
