go-redis
The official, idiomatic Go client for Redis — connection pooling, Cluster, Sentinel, pipelines, and client-side caching built in.
Repository Health
Technical Analysis
go-redis is the official Go client library for Redis, maintained by Redis, Inc. and the community. It provides typed, idiomatic wrappers for the full Redis command surface — strings, hashes, sets, sorted sets, streams, JSON, search, probabilistic data structures, and the new array type introduced in Redis 8.8 — alongside first-class support for Redis Cluster, Sentinel, and Ring-based sharding.
Beyond basic command coverage, go-redis ships production-grade operational features: automatic connection pooling with configurable dial retries, pipelines and transactions, an extensible Hook system for tracing and auth, optional OpenTelemetry instrumentation, client-side caching, and an experimental automatic-pipelining mode that batches concurrent commands for high-throughput workloads. It is one of the most widely used and heavily tested Redis clients in the Go ecosystem.
What You Get
- Full Redis command coverage — strings, hashes, sets, sorted sets, streams, JSON, search, probabilistic types, and the new AR* array command family
- Multiple deployment modes — Client, ClusterClient, Ring, and Sentinel-aware failover, unified behind a UniversalClient interface
- Built-in connection pooling with configurable dial retries and pluggable backoff
- Pipelines, transactions, and an experimental automatic-pipelining mode for high-throughput batching
- Extensible Hook system plus optional OpenTelemetry instrumentation for tracing and auth
Common Use Cases
- Caching layer for a web or API service backed by Redis
- Rate limiting and distributed locks built on Redis primitives
- Pub/Sub messaging and event fan-out between services
- Session storage and token/credential caching with streaming auth providers
- Powering Redis Cluster or Sentinel-based high-availability deployments
Under The Hood
Architecture
The root package exposes several client types — Client, ClusterClient, Ring, and a Sentinel-aware failover client — all sharing the same command-building layer (command.go, commands.go) and a hooksMixin that lets Dial/Process/ProcessPipeline behavior be wrapped without touching call sites. Underneath, internal/pool owns connection lifecycle (pool.go, conn.go, want_conn.go) and internal/proto implements the RESP2/RESP3 wire protocol directly (reader.go, writer.go, scan.go) rather than depending on a third-party parser. A UniversalClient interface and universal.go let application code target standalone, Cluster, or Sentinel deployments through the same configuration surface. Large subsystems layer on top of this core: autopipeline.go (over 100KB) implements automatic command batching for high-throughput scenarios, csc_integration.go adds client-side caching, and maintnotifications/ handles Redis Cluster maintenance push notifications. The Cmder abstraction that every per-command wrapper builds on is the load-bearing seam — every one of the hundreds of typed command methods depends on it.
Tech Stack
A Go 1.24 module with a deliberately minimal dependency footprint: github.com/cespare/xxhash/v2 and github.com/zeebo/xxh3 for cluster hashing, go.uber.org/atomic for lock-free state, golang.org/x/sys, and github.com/klauspost/cpuid/v2 for SIMD feature detection, with github.com/bsm/ginkgo/v2 and gomega used only in tests. The RESP wire protocol is implemented in-house rather than pulled from a dependency, and optional OpenTelemetry integration (otel.go) is wired in as an opt-in instrumentation layer. Docker Compose and a dockers/ directory spin up real Redis, Cluster, and Sentinel instances for integration testing, with CI split across build, end-to-end, and Redis Enterprise workflows.
Code Quality
Testing here is extensive — well over a hundred _test.go files covering unit tests, race-detector tests, fuzz tests (fuzz/, reader_fuzz_test.go), and protocol-level desync/truth tests that validate edge cases in the wire format, on top of full integration suites that run against live Redis via docker-compose. The bsm/ginkgo BDD framework is used alongside standard testing.T tests. Error handling is idiomatic Go with explicit returns and a typed sentinel error (redis.Nil) plus dedicated error-wrapping coverage. CI enforces golangci-lint with staticcheck’s near-complete ruleset, gofmt formatting, govulncheck dependency scanning, and CodeQL static analysis — a rigor level uncommon even among popular Go libraries.
API Design The public API favors compile-time safety over stringly-typed replies: each command returns a typed *Cmd wrapper (StringCmd, IntCmd, and so on) with Result()/Err() accessors matching that command’s actual return shape, and getting started takes only a handful of lines. Advanced capabilities — pipelining, transactions, cross-cutting hooks, automatic pipelining, and client-side caching — activate through configuration rather than API changes, and UniversalClient lets code move between standalone, Cluster, and Sentinel deployments without a rewrite. Documentation is thorough, with godoc comments throughout, a substantial README, and a doctests/ directory of runnable examples. It is not a novel protocol design, but the operational feature set — streaming credentials, maintenance notifications, hitless upgrades — goes well beyond a typical thin RESP client.
Used by 34 apps in this directory
Teleport
Authentication · Security
Zero-trust infrastructure access platform that replaces credentials and VPNs with short-lived certificates, SSO, and identity-aware proxies for SSH, Kubernetes, databases, RDP, and AI agents.
Traefik
Automation · Devops · Security
A cloud-native reverse proxy and load balancer that auto-configures itself from Docker, Kubernetes, and other orchestrators — zero manual routing required.
Tyk API Gateway
Developer Tools · Devops
Cloud-native, high-performance open-source API gateway for REST, GraphQL, gRPC, and TCP — built in Go since 2014 with no feature lockout.
Unkey
Developer Tools
An open-source developer platform for API infrastructure — issue and verify API keys, enforce global rate limits, route traffic through a gateway, and get per-key analytics and audit logs.
Uptrace
Devops · Monitoring
Unified open-source APM that collects OpenTelemetry traces, metrics, and logs into a single self-hosted platform backed by ClickHouse.
Vikunja
Project Management
Self-hosted task management with natural-language quick-add, multiple views, and a fully documented REST API — your tasks, your infrastructure, zero lock-in.
ZITADEL
Authentication
Open-source, API-first identity platform delivering multi-tenancy, Passkeys, OIDC, SAML, and SCIM without vendor lock-in.