go-redis
Redis Go client
go-redis is the official Go client library for Redis, letting your Go apps talk to Redis for caching, pub/sub messaging, transactions, and scripting with automatic connection pooling and retry logic.
go-redis is the official client library for Redis written in the Go programming language. Redis is a popular in-memory data store often used as a cache, a message broker, or a fast key-value database; a client library is the piece of code your application uses to talk to it. The README states that go-redis offers a straightforward interface for interacting with Redis servers, and it targets the last three Redis releases (currently Redis 8.0, 8.2, and 8.4 community editions). Although the go.mod requires at minimum Go 1.24, the CI also runs against older and newer Go versions, and the library should work with any Redis 7.0+, even if older versions are not officially supported. The way it works is that you create a client object — redis.NewClient with an address, optional password, and database number — and then call methods on it that correspond to Redis commands like Set and Get. Behind the scenes, the library handles automatic connection pooling so your application reuses TCP connections instead of opening one per request, and the pool can retry failed dials with a configurable number of attempts and an optional exponential-backoff hook. The README lists support for almost all Redis commands (except QUIT and SYNC), Pub/Sub messaging, pipelines and transactions for batching commands, Lua scripting, Redis Sentinel and Redis Cluster topologies, performance monitoring, probabilistic data types from RedisStack, and customizable read and write buffer sizes. Authentication has a clear priority order, including an experimental StreamingCredentialsProvider that allows dynamic credential updates during the lifetime of a connection — useful for managed-identity services such as Entra ID (formerly Azure AD), through a separate go-redis-entraid package. You would reach for this any time a Go application needs to talk to Redis: caching responses, storing session data, queueing background jobs, sharing state between services, or running distributed locks and rate limiters (the README points to companion packages like redislock, go-redis/cache, and redis_rate). Installation is a single go get of github.com/redis/go-redis/v9 after initialising a Go module.
Where it fits
- Cache API responses in a Go web server by storing results in Redis and fetching them on repeat requests.
- Store user session data in Redis so multiple Go service instances can share state.
- Implement distributed rate limiting or locking in a Go microservice using Redis and companion packages.
- Publish and subscribe to real-time events between Go services using Redis Pub/Sub.