Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue # 1697 FIX - creates an example script that shows how to use th…
…e SSCAN iterator (#1699) * #1697 fix for set scan example * adds the js file * adds comment * Minor layout and comment adjustment. Co-authored-by: srawat2 <shashank19aug> Co-authored-by: Simon Prickett <simon@redislabs.com> Closes #1697.
- Loading branch information
1 parent
fdffa23
commit d409120
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// An example script that shows how to use the SSCAN iterator functionality to retrieve the contents of a Redis set. | ||
// Create the set in redis-cli with this command: | ||
// sadd setName a b c d e f g h i j k l m n o p q | ||
|
||
import { createClient } from 'redis'; | ||
|
||
async function setScan() { | ||
const client = createClient(); | ||
await client.connect(); | ||
|
||
const setName = 'setName'; | ||
for await (const member of client.sScanIterator(setName)) { | ||
console.log(member); | ||
} | ||
|
||
await client.quit(); | ||
} | ||
|
||
setScan(); |