1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

chore(examples): fix examples for v5 (#2938)

This commit is contained in:
Nikolay Karadzhov
2025-05-05 11:35:41 +03:00
committed by GitHub
parent bd5c230c62
commit 2c9ad2e772
20 changed files with 133 additions and 75 deletions

View File

@@ -24,8 +24,30 @@ await client.zAdd('mysortedset', [
// Get all of the values/scores from the sorted set using
// the scan approach:
// https://redis.io/commands/zscan
for await (const memberWithScore of client.zScanIterator('mysortedset')) {
console.log(memberWithScore);
for await (const membersWithScores of client.zScanIterator('mysortedset')) {
console.log('Batch of members with scores:', membersWithScores);
for (const memberWithScore of membersWithScores) {
console.log('Individual member with score:', memberWithScore);
}
}
client.destroy();
await client.zAdd('anothersortedset', [
{
score: 99,
value: 'Ninety Nine'
},
{
score: 102,
value: 'One Hundred and Two'
}
]);
// Intersection of two sorted sets
const intersection = await client.zInter([
{ key: 'mysortedset', weight: 1 },
{ key: 'anothersortedset', weight: 1 }
]);
console.log('Intersection:', intersection);
client.close();