Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/derhuerst/redis-iterate-keys
Iterate over keys in Redis, using the SCAN command.
https://github.com/derhuerst/redis-iterate-keys
Last synced: 6 days ago
JSON representation
Iterate over keys in Redis, using the SCAN command.
- Host: GitHub
- URL: https://github.com/derhuerst/redis-iterate-keys
- Owner: derhuerst
- License: isc
- Created: 2020-06-26T15:23:29.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-26T15:34:07.000Z (over 4 years ago)
- Last Synced: 2024-10-03T23:56:11.468Z (about 1 month ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# redis-iterate-keys
**Iterate over keys in [Redis](https://redis.io/)**, using the [`SCAN` command](https://redis.io/commands/scan).
[![npm version](https://img.shields.io/npm/v/redis-iterate-keys.svg)](https://www.npmjs.com/package/redis-iterate-keys)
[![build status](https://api.travis-ci.org/derhuerst/redis-iterate-keys.svg?branch=master)](https://travis-ci.org/derhuerst/redis-iterate-keys)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/redis-iterate-keys.svg)
![minimum Node.js version](https://img.shields.io/node/v/redis-iterate-keys.svg)
[![chat with me on Gitter](https://img.shields.io/badge/chat%20with%20me-on%20gitter-512e92.svg)](https://gitter.im/derhuerst)
[![support me via GitHub Sponsors](https://img.shields.io/badge/support%20me-donate-fa7664.svg)](https://github.com/sponsors/derhuerst)## Installation
```shell
npm install redis-iterate-keys
```## Usage
```js
const Redis = require('ioredis')
const iterateKeys = require('redis-iterate-keys')const redis = new Redis()
for await (const key of iterateKeys(redis)) {
console.log(key)
}
redis.quit()
``````js
iterateKeys(redisClient, opt = {})
```You can pass the following options:
- `opt.match`: Match keys with a pattern, see the [`MATCH` docs](https://redis.io/commands/scan#the-match-option)
- `opt.batchSize`: How many keys to retrieve in one `SCAN` call. Set it to a higher number for higher iteration speed. Default: 20## Related
- [`redis-scanrx`](https://github.com/sukobuto/redis-scanrx) – Rx interface to Redis `SCAN`.
- [`redis-skim`](https://github.com/mattbudish/redis-skim) – Callback interface to Redis `SCAN`.## Contributing
If you have a question or need support using `redis-iterate-keys`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, use [the issues page](https://github.com/derhuerst/redis-iterate-keys/issues).