Examples

May 28, 2026 ยท View on GitHub

Runnable examples for Valkey GLIDE Ruby. Requires a Valkey or Redis OSS server unless noted.

Prerequisites

From the repository root:

bin/setup

Run examples with the gem loaded from lib/:

bundle exec ruby examples/standalone.rb

Or:

RUBYOPT="-I$(pwd)/lib" ruby examples/standalone.rb

Examples

FileDescriptionServer
standalone.rbBasic connect, SET, GETStandalone :6379
cluster.rbCluster connect, SET, GETCluster :7000โ€“:7005
pipelining.rbNon-atomic pipelineStandalone :6379
opentelemetry.rbOTel file exporter + traced commandsStandalone :6379
statistics.rbClient statisticsStandalone :6379

Environment variables

VariableDefaultPurpose
VALKEY_HOST127.0.0.1Server host
VALKEY_PORT6379Standalone port
VALKEY_CLUSTER_PORT7000First cluster node port

Standalone with Docker

docker run -d --name valkey -p 6379:6379 valkey/valkey:8
bundle exec ruby examples/standalone.rb

Cluster with Docker

docker run -d -p 7000-7005:7000-7005 grokzen/redis-cluster:7.0.15
bundle exec ruby examples/cluster.rb