Skip to content

Iterate over keys in Redis, using the SCAN command.

License

Notifications You must be signed in to change notification settings

derhuerst/redis-iterate-keys

Repository files navigation

redis-iterate-keys

Iterate over keys in Redis, using the SCAN command.

npm version build status ISC-licensed minimum Node.js version chat with me on Gitter support me via GitHub Sponsors

Installation

npm install redis-iterate-keys

Usage

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()
iterateKeys(redisClient, opt = {})

You can pass the following options:

  • opt.match: Match keys with a pattern, see the MATCH docs
  • opt.batchSize: How many keys to retrieve in one SCAN call. Set it to a higher number for higher iteration speed. Default: 20

Related

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.

About

Iterate over keys in Redis, using the SCAN command.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published