go-redis is the official Redis client for Go. It provides a direct API for talking to standalone, clustered, and Sentinel-managed Redis deployments.
Overview
go-redis wraps Redis protocol access for Go programs that need caching, messaging, or other Redis-backed data patterns. The client covers standard Redis commands with documented exceptions, pools connections automatically, and can batch concurrent operations through experimental automatic pipelining for high-load scenarios.
Authentication can flow through several mechanisms with a defined priority order, including streaming credential providers suited to token-based and managed-identity flows, context-based providers, simple credential callbacks, and static username and password fields. Both RESP2 and RESP3 are selectable in client options.
Cluster users get configurable routing metadata, optional fan-out behavior, and separate helpers for Sentinel failover via dedicated client constructors. Server-assisted client-side caching is available for standalone and cluster clients under RESP3, with tracking modes and context marks to control what gets cached locally.
Newer Redis array types are exposed through an experimental AR command family in the client. The module targets recent Go releases and tracks compatibility with current Redis CE lines described in the project documentation.
Key features
- Automatic connection pooling
- Redis Cluster and Sentinel clients
- Streaming and context-based authentication
- RESP2 and RESP3 protocol selection
- Experimental automatic pipelining
- Server-assisted client-side caching
- Cluster command metadata and fan-out options
- Redis array type AR command support
Use cases
- Connecting Go services to Redis caches
- Building apps on Redis Cluster or Sentinel
- High-throughput pipelines from Go workers
- Token-based auth to managed Redis endpoints
- Reducing round trips with client-side caching