Comparing go-redis vs redigo

Featurego-redisopen in new windowredigoopen in new window
GitHub stars15k+9k+
Type-safe✔️
Connection poolingAutomaticManual
Custom commands✔️✔️
High-level PubSub API✔️
Redis Sentinel client✔️Using a plugin
Redis Cluster client✔️Using a plugin
Redis Ring✔️
OpenTelemetry instrumentation✔️

The main difference between 2 projects is that go-redis provides type-safe API for each Redis command but redigo uses print-like API:

// go-redis
timeout := time.Second
_, err := rdb.Set(ctx, "key", "value", timeout).Result()


// redigo
_, err := conn.Do("SET", "key", "value", "EX", 1)

That said, go-redis also supports print-like API if you need it:

// go-redis print-like API
ok, err := rdb.Do(ctx, "SET" "key", "value", "EX", 1).Bool()

Also, go-redis automatically uses connection pooling but redigo requires explicit connection management:

// go-redis implicitly uses connection pooling
_, err := rdb.Set(...).Result()

// redigo requires explicit connection management
conn := pool.Get()
_, err := conn.Do(...)
conn.Close()

But if you need to manage connections manually, go-redis allows you to do that as well:

// go-redis manual connection management
conn := rdb.Conn(ctx)
_, err := conn.Set(...).Result()
conn.Close()