redis/redis-rb
63.2
Adequate · 28 September 2026
16.9k
lines of production code
Ruby
primary language
2
measurements over time
What this system is
This system is a Ruby client library for interacting with Redis, supporting standalone, cluster, and sentinel deployment modes. It provides comprehensive command coverage including core data structures, JSON and Search modules, and vector similarity search, while handling protocol negotiation between RESP2 and RESP3. The library includes utilities for performance benchmarking, interactive debugging, and robust testing infrastructure to ensure reliability across various Redis configurations.
How it got here
2009–2010 — RESP3 migration and infrastructure modernization
8 changes.
The project underwent a significant architectural overhaul, migrating the Redis client to use the redis-client gem and adopting RESP3 as the default protocol with automatic fallback to RESP2. This period also involved modernizing the development environment through containerization, enforcing Ruby 3.2+ requirements, and refactoring the test suite to Minitest with comprehensive linting for new data types.
2012–2022 — Redis Cluster client and command expansion
13 changes.
This period focused on introducing a dedicated Redis Cluster client with support for transactions, keyspace notifications, and optimistic locking. It also involved refactoring the command API into modular components to accommodate new Redis features like vector sets and geospatial search, while significantly expanding test coverage for distributed, sentinel, and cluster environments.
2024–2026 — Redis Modules and Protocol Support
8 changes.
This period focused on expanding client capabilities by adding comprehensive support for RedisJSON and RediSearch modules, including a fluent builder API for RediSearch. It also introduced interactive debugging tools, performance benchmarking for RESP2 versus RESP3 protocols, and extensive test coverage to ensure reliability across these new features.
Features
Added IRB console script for Redis interaction
A new executable script at bin/console has been added to the project. This script sets up the Ruby load path to include the local library, requires the 'redis' gem, and launches an IRB session, allowing users to interactively test and debug Redis connections using the application's codebase.
bin · high confidence
Added RESP2 vs RESP3 performance benchmarking tool
A new benchmark script (bench/resp\_comparison.rb) has been added to compare the performance of Redis RESP2 and RESP3 protocols. The tool measures throughput (RPS) and CPU usage across various workload complexities—including simple GETs, hash flattening (HGETALL), score pairing (ZRANGE WITHSCORES), and stream entry parsing (XRANGE)—under both single-threaded and multi-threaded scenarios, allowing users to evaluate protocol efficiency for their specific use cases.
bench · high confidence
Added Redis clustering library entry point
A new file, cluster/lib/redis-clustering.rb, has been added to the codebase. This file serves as a simple entry point that requires the 'redis/cluster' library, enabling users to access Redis clustering functionality through this specific path.
cluster/lib · high confidence
Added cluster console script for interactive Redis Cluster sessions
A new executable script \cluster/bin/console\ has been added to the project. This script sets up an interactive Ruby IRB environment with the \redis/cluster\ library loaded, allowing users to manually interact with a Redis Cluster instance for debugging or exploration purposes.
cluster/bin · high confidence
Added support for RedisJSON and RediSearch modules
This change introduces client-side support for the RedisJSON and RediSearch modules. The new \lib/redis/commands/modules/json.rb\ file implements JSON CRUD operations (including \JSON.SET\, \JSON.GET\, \JSON.MSET\, and \JSON.MGET\) with automatic serialization and deserialization of Ruby objects to/from JSON text, along with protocol-independent reply normalization for RESP2 and RESP3. Additionally, \lib/redis/commands/modules/search.rb\ initializes the RediSearch command interface by requiring the necessary sub-components for index definitions, schemas, queries, and aggregation.
lib/redis/commands/modules · high confidence
Cluster client now supports transactions and keyspace notifications
The cluster client now supports transactions and keyspace notifications. Transactions are implemented via a new TransactionAdapter that wraps the underlying RedisClient::Cluster transaction, ensuring compatibility with the standalone client's API while handling cluster-specific constraints like node routing and optimistic locking. Keyspace notifications are supported through a new KeyspaceNotifications manager that fans out subscriptions to all cluster primaries, preserving per-node ordering and handling topology changes reactively. The client also includes error mapping for cluster-specific errors and supports the RESP3 protocol.
cluster/lib/redis/cluster · high confidence
Introduce Redis Cluster client with transaction, HIMPORT, and keyspace notification support
This change adds the \Redis::Cluster\ client class, enabling users to connect to and operate on Redis Cluster deployments. The new client supports optimistic locking via a block-based \watch\ API, implements the \HIMPORT\ command family with automatic fieldset recovery and routing overrides for API parity, and provides a \keyspace\_notifications\ manager that subscribes to events on all primary nodes. It also includes specific error classes for cluster-specific scenarios (such as \NodeMightBeDown\ and \CommandErrorCollection\) and allows client identification via \CLIENT SETINFO\.
cluster/lib/redis · high confidence
Introduces a fluent builder API for the Redis Query Engine (RediSearch)
Adds a new set of classes in the \lib/redis/commands/modules/search\ directory to provide a structured, object-oriented interface for RediSearch commands. This includes \Index\ for managing index creation and document operations, \Query\ and \AggregateRequest\ for building \FT.SEARCH\ and \FT.AGGREGATE\ requests with a fluent builder pattern, and \Field\ subclasses for defining schemas. The implementation also introduces support for the Query Engine's dialect 2 (the new default), hybrid vector-text search via \HybridQuery\, and explicit handling of index definitions and result parsing.
lib/redis/commands/modules/search · high confidence
New Redis Search example scripts for aggregations, geospatial, hybrid, and vector similarity search
The examples/search directory now includes several new Ruby scripts demonstrating advanced Redis Search capabilities. search\_aggregations.rb shows how to use FT.AGGREGATE with reducers like COUNT, SUM, AVG, and GROUPBY operations. search\_geo.rb demonstrates geospatial queries using geo and geoshape fields for radius and polygon-based searches. search\_hybrid.rb introduces hybrid search (FT.HYBRID) combining lexical and vector similarity legs with fusion strategies like RRF and LINEAR. search\_vector\_similarity.rb covers vector similarity search with HNSW and FLAT algorithms, including KNN and hybrid vector-filter queries. search\_raw\_ft\commands.rb provides low-level examples using raw FT.\ commands as an alternative to the high-level Index API.
examples/search · high confidence
New and updated example scripts for Redis features
The examples directory now includes standalone scripts demonstrating basic operations, distributed Redis, lists, sets, and increment/decrement commands. New examples cover Pub/Sub with automatic reconnection, Sentinel failover simulation, and a consistency test for verifying write integrity. Additionally, examples for Keyspace and Subkey notifications are provided, including a version-aware script for Redis 8.8+ subkey support and a pool-integrated variant for multi-threaded environments.
examples · high confidence
Architecture
Repository restructured with modern tooling and documentation
The repository has been reorganized to support modern development workflows. A new \.rubocop.yml\ configuration enforces code style for Ruby 3.2+, and a \.ruby-version\ file sets the target runtime to 3.3.0. Development infrastructure is now containerized via \docker-compose.yml\ and managed through a \makefile\, allowing developers to easily spin up standalone, sentinel, cluster, and module test environments. Comprehensive documentation has been added, including \AGENTS.md\ for architectural guidance and a detailed \CHANGELOG.md\ outlining the 6.0.0 release features and breaking changes. The legacy \redis.rb\ script has been removed as the gem is now installed via standard RubyGems.
(repo-wide) · high confidence
Behavioural changes
9 commits (1 fix) modifying examples/sentinel
A change to existing behaviour in examples/sentinel — 9 commits (1 fix), 2 files.
examples/sentinel · medium confidence · unverified
Redis client now defaults to RESP3 with automatic fallback to RESP2
The Redis client now uses the RESP3 protocol by default for all connections, providing native types (maps, sets, doubles) and improved performance. If the server does not support RESP3 (e.g., Redis \< 6.0 or servers rejecting HELLO 3), the client automatically falls back to RESP2, ensuring compatibility with older Redis versions. This change is transparent to users, but may affect reply types in pipelines and transactions if not handled correctly.
lib/redis · high confidence
Redis client now uses redis-client as the underlying transport layer
The Redis library has been refactored to use the \redis-client\ gem for network communication, replacing the previous internal socket and protocol implementation. This change introduces support for the RESP3 protocol (negotiated via the \:protocol\ option, defaulting to 3), allows passing a \:driver\ option to select between \:ruby\ and \:hiredis\ backends, and adds new connection options such as \:username\ for ACL authentication, \:driver\_info\ for client identification, and \:himport\_auto\_prepare\ for automatic hash fieldset recovery. The public API remains largely compatible, but internal methods like \queue\ and \commit\ have been removed in favor of block-based pipelining, and the \Redis.current\ global accessor has been deprecated.
lib · high confidence
Refactored command API into modular files and added new Redis commands
The Redis command interface has been reorganized into distinct modules (such as Arrays, Bitmaps, Geo, Hashes, Lists, Pubsub, and Scripting) to improve maintainability. This change introduces support for new Redis commands including array operations (arset, arget, armset, armget, ardel, arinsert, arseek), list multi-move commands (LMOVEM, BLMOVEM), geospatial search (GEOSEARCH, GEOSEARCHSTORE), and Redis Functions management (FUNCTION LOAD, LIST, DELETE, STATS). It also adds new options to existing commands, such as NX/XX/GT/LT for expiration commands and WITHSCORE for sorted set ranking commands.
lib/redis/commands · high confidence
Unicorn example demonstrates safe Redis connection handling after forking
The Unicorn example now includes a configuration that disconnects the Redis client after the worker process forks. This prevents multiple worker processes from sharing a single file descriptor, which can lead to concurrency issues and protocol errors. The example also enforces frozen string literals for compatibility.
examples/unicorn · high confidence
Test coverage
Added Redis Sentinel configuration files for test infrastructure; Added SSL test fixtures and certificate generation script; Added comprehensive test suite for Redis cluster client; Added distributed test coverage for Redis commands and internals; Added placeholder for test/db directory; Added sentinel test suite; Added test infrastructure for mocking Redis connections; Added tests for JSON module commands and Search module schema/DSL; Added tests for the add-new-command skill and its spec resolver; Comprehensive lint test suite for Redis data types and commands; Expanded test coverage for Redis commands and client internals; Refactor test infrastructure to use Minitest and RESP3.
Dependencies
Update gem dependencies and require Ruby 3.2+
The redis and redis-clustering gems now require Ruby 3.2.0 or later. The core redis gem pins its runtime dependency on redis-client to version 0.30.1, and the redis-clustering gem depends on redis-cluster-client version 0.17.0. Development dependencies have been organized into Gemfiles, including minitest, rake, rubocop (\~\> 1.88.0), mocha, and hiredis-client.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 73 → 63 (-10.1)
- Rubric changed (rubric-2026.09.8 → rubric-2026.09.16) — scores are not directly comparable.
Lenses
- Code Health 92 → 92 (-0.1)
- Architecture 100 → 75 (-25.4)
- Maturity 63 → 63 (+0.1)
- Readiness 74 → 53 (-21.4)
- Security 89 → 91 (+2.3)
Resolved (4)
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- Hotspot: lib/redis/commands/modules/search/miscellaneous.rb (lib/redis/commands/modules/search/miscellaneous.rb)
- Off-boarding risk: anonymized user #1
New (7)
- Confusingly similar operations: KeyspaceNotifications has a subscribe method, and its internal NodeListener also has a subscribe method. While one is public-facing and the other internal, the naming collision suggests a potential design flaw where the public API delegates to an internal API with identical method names, which can be confusing during debugging or if the internal API is accidentally exposed.
- Duplicate intent: Two methods with nearly identical names and signatures exist for checking key existence. In Ruby, the ? suffix is conventionally used for predicate methods, making exists? the standard form. Having both exists and exists? creates confusion about which to use, as they likely perform the same operation.
- Off-boarding risk: anonymized user #1
- Projects may be oversized for their cohesion
- Redundant operations across types: The himport_* methods are exposed on the main Redis client, the Redis.Cluster client, and the Redis.Commands.Hashes module. While this might be due to module inclusion, exposing the same high-level batch import API on the top-level Redis and Redis.Cluster types alongside the granular Commands module creates a fragmented API surface. Users may not know which entry point to use.
- Strings.set (cognitive 16) (lib/redis/commands/strings.rb)
- Strings.set (cyclomatic 16) (lib/redis/commands/strings.rb)
Changes since last survey
- 4 commits — 4 feature/other, 0 fixes
By area
- lib/redis — 4 commits
Notable commits
- change: Added support for CAS/CAD commands + local XXH3 hashing (#1393)
- change: Added support for Redis 8.2 stream policies arguments (#1392)
- change: Added support for missing HFE commands (#1389)
- change: Added support for missing Redis 8.2 commands (#1391)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
redis/redis-rb was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 28 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 8dcf4d07e251188431a0561b4ab090ce3a209419 — the exact code this score is about.
- Scored under rubric-2026.09.16 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-2d9048c36d26.