Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Jul 8, 2025

This PR replaces all code examples using redis-rb-cluster in the cluster tutorial with examples using the official Valkey GLIDE Node.js client, while preserving the original Ruby example's logic and behavior.

Problem

The redis-rb-cluster library referenced in the cluster tutorial:

  • Doesn't contain a LICENSE file, making it technically not open source
  • Is maintained by antirez and not officially supported by Valkey
  • Uses Ruby, which may be less accessible to some developers

Changes Made

Code Examples

  • Replaced Ruby example with comprehensive Node.js example using @valkey/valkey-glide
  • Preserved original logic: SET key → GET verification → SET counter → delay pattern
  • Updated installation instructions with npm install @valkey/valkey-glide
  • Modernized code style using async/await syntax and proper error handling
  • Maintained same timing with 100ms delays matching Ruby's 0.1 second sleep
  • Added retry logic for counter initialization matching Ruby's while loop behavior

Documentation Updates

  • Section title: "Write an example app with redis-rb-cluster" → "Write an example app with Valkey GLIDE"
  • Table of contents: Updated to reflect new section name
  • Links: All references now point to official Valkey GLIDE repository
  • Command examples: Updated from ruby example.rb to node example.js
  • Output examples: Updated to show individual value verification (1, 2, 3...) matching original behavior

Example Comparison

Before (Ruby):

rc.set("foo#{x}",x)
puts rc.get("foo#{x}")
rc.set("__last__",x)
sleep 0.1

After (Node.js with equivalent logic):

await client.set(`foo${x}`, x.toString());
const value = await client.get(`foo${x}`);
console.log(value);
await client.set("__last__", x.toString());
await new Promise(resolve => setTimeout(resolve, 100));

The new examples maintain the exact same educational value and behavior while using an officially supported, properly licensed Valkey client library. The implementation ensures compatibility with cluster deployments and preserves the original example's demonstration of cluster operations under real-world conditions.

Fixes #147.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@avifenesh
Copy link
Member

@Copilot Copilot AI changed the title [WIP] Replace code example in cluster-tutorial Replace redis-rb-cluster examples with official Valkey GLIDE client Jul 8, 2025
@Copilot Copilot AI requested a review from avifenesh July 8, 2025 21:50
Copilot finished work on behalf of avifenesh July 8, 2025 21:50
Copy link
Author

Copilot AI commented Jul 8, 2025

@copilot use valkey-glide nodejs https://github.com/valkey-io/valkey-glide/tree/main/node

Updated the implementation to use the official Valkey GLIDE Node.js API from the specified repository. Fixed the client configuration structure, updated timeout settings, and added clientName parameter to match the official documentation examples. Commit: 8fd3fad

Copilot finished work on behalf of avifenesh July 8, 2025 21:56
@Copilot Copilot AI requested a review from avifenesh July 8, 2025 22:05
Copilot finished work on behalf of avifenesh July 8, 2025 22:05
@Copilot Copilot AI requested a review from avifenesh July 8, 2025 22:09
Copilot finished work on behalf of avifenesh July 8, 2025 22:09
@avifenesh avifenesh marked this pull request as ready for review July 8, 2025 22:09
Copilot

This comment was marked as outdated.

@Copilot Copilot AI requested a review from avifenesh July 8, 2025 22:16
Copilot finished work on behalf of avifenesh July 8, 2025 22:16
Copilot AI and others added 5 commits August 5, 2025 10:36
Signed-off-by: Avi Fenesh <[email protected]>
Signed-off-by: Avi Fenesh <[email protected]>
Signed-off-by: Avi Fenesh <[email protected]>
@Copilot Copilot AI changed the title Replace redis-rb-cluster examples with official Valkey GLIDE client Replace redis-rb-cluster examples with official Valkey GLIDE client using individual SET operations Aug 5, 2025
Copilot finished work on behalf of avifenesh August 5, 2025 13:09
Copy link
Author

Copilot AI commented Aug 6, 2025

remove the html files

The HTML files were already removed in a previous commit (8c0482a). The repository is now clean of any HTML test files.

Copilot finished work on behalf of avifenesh August 6, 2025 20:53
Co-authored-by: Madelyn Olson <[email protected]>
Signed-off-by: Avi Fenesh <[email protected]>
Comment on lines 457 to 458
* `MSET foo1 1 foo2 2 foo3 3 ... foo100 100` (batch of 100 keys)
* `MSET foo101 101 foo102 102 ... foo200 200` (next batch)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a follow up issue with @asafpamzn points

@Copilot Copilot AI changed the title Replace redis-rb-cluster examples with official Valkey GLIDE client using individual SET operations Replace redis-rb-cluster examples with official Valkey GLIDE client using original Ruby logic Aug 14, 2025
Copilot finished work on behalf of avifenesh August 14, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace code example in cluster-tutorial
6 participants