Skip to content
Using the Redis SSCAN command with a JavaScript generator function.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
index.js
package-lock.json
package.json

README.md

redis-sscan-with-generator

See my blog post about this here.

Description

Example using a JavaScript generator function to retrieve members from a Redis set using the SSCAN command.

Setup

You will need to be running Redis at 127.0.0.1:6379, or change index.js to point at your Redis server.

Usage

$ npm install
$ npm start

Expected Output

The generator should fire three times before Redis has no more set members to return:

Retrieved: shark,viper,herbie,phoenix,sierra,geordie,bear,rocky,ghost,mcqueen,iceman,maverick
Retrieved: vader,crockett,mule,tiger,charlie,panther,rico,wolf,tubbs,astronaut
Retrieved: shepherd,phantom,ripley
You can’t perform that action at this time.