go-redis is a free, open source databases project written in Go and released under BSD-2-Clause. It has 22,242 GitHub stars, 2,591 forks and 66 open issues, and was last pushed 13 hours ago. On this registry it ranks #29 of 81 tracked projects in Databases, with 5 head-to-head comparisons available. It gained 10 stars over the last 3 tracked days.

What is go-redis?

go-redis is the official Redis client library for the Go programming language, published as github.com/redis/go-redis/v9 under the BSD-2-Clause licence, and it is aimed at Go developers whose applications need to talk to Redis servers.

What it is

go-redis is the official Redis client for Go, kept in the redis/go-redis repository on GitHub and pointing at redis.io as its homepage. The README states that it offers a straightforward interface for interacting with Redis servers, and the current module path is github.com/redis/go-redis/v9. It lives in the Go ecosystem, carrying the topics go, golang, redis, redis-client and redis-cluster, with 22,242 stars, 2,590 forks and 66 open issues at the time of writing.

The problem it solves is the distance between a Go program and a Redis server. Instead of hand-writing connection handling and command encoding against the Redis protocol, an application calls a client API that the Redis project itself maintains and tests against supported server releases. The supplied facts name no specific predecessor library that this client replaces, so the honest framing is that it is the officially maintained route to Redis from Go, covering both single-server and Redis Cluster deployments as signalled by the redis-cluster topic.

Key capabilities

  • Official Redis client library for Go, with reference documentation and runnable package examples published on pkg.go.dev under github.com/redis/go-redis/v9.
  • The README states a support target of the last three Redis releases and then lists Redis 8.0, 8.2, 8.4, 8.8 and 8.10, tested against Redis CE builds.
  • The minimum Go version declared in go.mod is Go 1.24, and CI runs the test suite against Go 1.24, oldstable and stable in combination with every supported Redis version.
  • Redis 8.8 and newer expose the array data type through the AR* command family — ARSET, ARGET, ARGETRANGE, ARMSET, ARMGET, ARINSERT, ARDEL, ARDELRANGE, ARLEN, ARCOUNT, ARNEXT, ARSEEK, ARSCAN, ARGREP, ARRING, ARLASTITEMS, ARINFO/ARINFOFULL and the AROP* reducers — with the full surface in array_commands.go. The README marks this API as experimental and subject to change.
  • Documented compatibility caveats: v9 is not officially supported below the listed releases but should work with any Redis 7.0 or newer, some module-related tests may not pass with Redis Stack 7.2, and some commands changed in Redis CE 8.0.
  • Ecosystem companions listed by the README include go-redis-entraid for Entra ID (Azure AD) authentication, bsm/redislock for distributed locks, go-redis/cache for caching, and rate limiting.
  • Release history is tracked in RELEASE-NOTES.md and GitHub Releases, with community support through GitHub Discussions, Discord and the Stack Overflow tag go-redis.

Who uses it and how

  • Go teams running Redis CE 8.0 through 8.10 who want a client aligned with those server releases; teams on Redis 7.0 and newer can still use v9 without official support.
  • Applications deployed against Redis Cluster, which the repository signals with the redis-cluster topic.
  • Services that authenticate with Microsoft Entra ID (Azure AD) can pair the client with the go-redis-entraid companion module.
  • Programs that need distributed locks, a cache layer or rate limiting build on the sibling packages the README lists rather than on the client alone.
  • Teams exploring the Redis 8.8 array data type through the AR* commands, accepting that those APIs may change in a future release.

Getting started

Install the current module with go get github.com/redis/go-redis/v9. Reference documentation and examples live on pkg.go.dev, alongside client documentation on redis.io.

How it compares

The supplied facts name no competing library and no paid product, so this page cannot contrast go-redis with alternatives on licence, self-hosting, data ownership or cost model. It stands alone in this registry as the officially maintained Redis client for Go.

When to use it — and when not to

go-redis is a client library only, so a self-hoster still has to run and operate the Redis server separately; nothing here provisions, hosts or backs up a database. It is a poor fit for anyone who needs the array data type in production today, given the README's warning that the AR* API is experimental and may change. The other evident weakness is support scope: official coverage stops at the last releases the README lists, older servers fall into best-effort territory, and part of the historical documentation still sits on the legacy redis.uptrace.dev site.

project readme (upstream, from github) — read inline

Redis client for Go

build workflow PkgGoDev Documentation Go Report Card codecov

Discord Twitch YouTube Twitter Stack Exchange questions

go-redis is the official Redis client library for the Go programming language. It offers a straightforward interface for interacting with Redis servers.

Supported versions

In go-redis we are aiming to support the last three releases of Redis. Currently, this means we do support:

Although the go.mod states it requires at minimum go 1.24, our CI is configured to run the tests against all supported versions of Redis and multiple versions of Go (1.24, oldstable, and stable). We observe that some modules related test may not pass with Redis Stack 7.2 and some commands are changed with Redis CE 8.0. Although it is not officially supported, go-redis/v9 should be able to work with any Redis 7.0+. Please do refer to the documentation and the tests if you experience any issues.

Array data type (Redis 8.8+)

Starting with Redis 8.8, go-redis exposes the new array data type via the AR* command family (ARSET, ARGET, ARGETRANGE, ARMSET, ARMGET, ARINSERT, ARDEL, ARDELRANGE, ARLEN, ARCOUNT, ARNEXT, ARSEEK, ARSCAN, ARGREP, ARRING, ARLASTITEMS, ARINFO/ARINFOFULL, and the AROP* reducers). See array_commands.go for the full surface. The API is experimental and may change in a future release.

How do I Redis?

Learn for free at Redis University

Build faster with the Redis Launchpad

Try the Redis Cloud

Dive in developer tutorials

Join the Redis community

Work at Redis

Resources

old documentation

Ecosystem

Features

Installation

go-redis supports 2 last Go versions and requires a Go version with modules support. So make sure to initialize a Go module:

go mod init github.com/my/repo

Then install go-redis/v9:

go get github.com/redis/go-redis/v9

Quickstart

import (
    "context"
    "fmt"

    "github.com/redis/go-redis/v9"
)

var ctx = context.Background()

func ExampleClient() {
    rdb := redis.NewClient(&redis.Options{
        Addr:     "localhost:6379",
        Password: "", // no password set
        DB:       0,  // use default DB
    })
    defer rdb.Close()

    err := rdb.Set(ctx, "key", "value", 0).Err()
    if err != nil {
        panic(err)
    }

    val, err := rdb.Get(ctx, "key").Result()
    if err != nil {
        panic(err)
    }
    fmt.Println("key", val)

    val2, err := rdb.Get(ctx, "key2").Result()
    if err == redis.Nil {
        fmt.Println("key2 does not exist")
    } else if err != nil {
        panic(err)
    } else {
        fmt.Println("key2", val2)
    }
    // Output: key value
    // key2 does not exist
}

Dial retries and backoff

Connection establishment can be retried by the connection pool when dialing fails.

  • DialerRetries: maximum number of dial attempts (default: 5).
  • DialerRetryTimeout: default delay between attempts when no custom backoff is provided (default: 100ms).
  • DialerRetryBackoff: optional function hook to control the delay between attempts.

Example:

rdb := redis.NewClient(&redis.Options{
	Addr: "localhost:6379",

	DialerRetries:      5,
	DialerRetryTimeout: 100 * time.Millisecond, // used when DialerRetryBackoff is nil

	// Optional: exponential backoff with jitter and a cap.
	DialerRetryBackoff: redis.DialRetryBackoffExponential(100*time.Millisecond, 2*time.Second),
})
defer rdb.Close()

Authentication

The Redis client supports multiple ways to provide authentication credentials, with a clear priority order. Here are the available options:

1. Streaming Credentials Provider (Highest Priority) - Experimental feature

The streaming credentials provider allows for dynamic credential updates during the connection lifetime. This is particularly useful for managed identity services and token-based authentication.

type StreamingCredentialsProvider interface {
    Subscribe(listener CredentialsListener) (Credentials, UnsubscribeFunc, error)
}

type CredentialsListener interface {
    OnNext(credentials Credentials)  // Called when credentials are updated
    OnError(err error)              // Called when an error occurs
}

type Credentials interface {
    BasicAuth() (username string, password string)
    RawCredentials() string
}

Example usage:

rdb := redis.NewClient(&redis.Options{
    Addr: "localhost:6379",
    StreamingCredentialsProvider: &MyCredentialsProvider{},
})

Note: The streaming credentials provider can be used with go-redis-entraid to enable Entra ID (formerly Azure AD) authentication. This allows for seamless integration with Azure's managed identity services and token-based authentication.

Example with Entra ID:

import (
    "github.com/redis/go-redis/v9"
    "github.com/redis/go-redis-entraid"
)

// Create an Entra ID credentials provider
provider := entraid.NewDefaultAzureIdentityProvider()

// Configure Redis client with Entra ID authentication
rdb := redis.NewClient(&redis.Options{
    Addr: "your-redis-server.redis.cache.windows.net:6380",
    StreamingCredentialsProvider: provider,
    TLSConfig: &tls.Config{
        MinVersion: tl

readme truncated — read the full docs on github

Frequently asked questions

Is go-redis free to use?

go-redis is open source under the BSD-2-Clause licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does go-redis do?

Redis Go client

What is go-redis written in?

go-redis is primarily written in Go. Its source is publicly available at https://github.com/redis/go-redis, and it has 22,242 GitHub stars.