Skip to content

task(client): consolidate redundant command implementations into BaseClient #462

Description

@currantw

Description

Many connection management and server management commands are declared abstract on BaseClient and then implemented identically (or near-identically) in both GlideClient and GlideClusterClient. The cluster client explicitly passes a route (e.g., Route.Random, AllPrimaries), but in most cases this matches the redis-rs default routing that glide-core applies when no route is provided.

This means the no-route overloads could be consolidated into a single concrete implementation on BaseClient, eliminating duplication.

Commands where glide-core default routing matches GlideClusterClient's explicit route:

Command Default Route
CLIENT GETNAME Random
CLIENT ID Random
CLIENT PAUSE AllPrimaries
CLIENT PAUSE (write) AllPrimaries
CLIENT UNPAUSE AllPrimaries
CLIENT TRACKINGINFO Random
ECHO Random
PING AllPrimaries

Commands where glide-core default does NOT match (requires investigation):

Command Default Route Cluster Client Uses
SELECT AllNodes Random
RESET AllNodes (no cluster override)

The scope includes connection management commands initially, but the same pattern likely applies to server management commands as well.

Checklist

  • Audit all BaseClient abstract methods where both GlideClient and GlideClusterClient override with the same Request.X() call (differing only by route).
  • For each command, verify glide-core default routing matches the explicit route used by GlideClusterClient.
  • Move matching no-route implementations from both clients into BaseClient as concrete methods.
  • Investigate and fix discrepancies (SELECT routed as Random vs AllNodes default; RESET has no cluster override).
  • Verify integration tests pass for both standalone and cluster modes.

Related

Additional Information

  • The route-specific overloads (e.g., ClientGetNameAsync(Route route)) on GlideClusterClient are unaffected — those stay as cluster-only methods.
  • This refactor reduces code duplication and ensures routing is consistently sourced from glide-core rather than being manually specified in C#.

Metadata

Metadata

Assignees

Labels

coreCore library (`sources/Valkey.Glide/`)devInternal changes like cleanup, refactoring, or developer tools.

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions