go-redis
by
redis

Description: Redis Go client

View redis/go-redis on GitHub ↗

Summary Information

Updated 2 hours ago
Added to GitGenius on August 14th, 2025
Created on July 25th, 2012
Open Issues/Pull Requests: 69 (+0)
Number of forks: 2,538
Total Stargazers: 21,939 (+0)
Total Subscribers: 252 (+0)
Detailed Description

go-redis is a robust and feature-rich Go client for Redis. Developed and maintained by the Redis team, it aims to provide a comprehensive and idiomatic interface for interacting with Redis databases from Go applications. It's widely considered the de-facto standard Redis client in the Go ecosystem, boasting high performance, extensive functionality, and strong community support. The library supports a wide range of Redis versions, including the latest features, and prioritizes connection pooling and efficient data handling.

At its core, go-redis offers a `*redis.Client` struct which represents a connection to a Redis server. Creating a client involves specifying connection parameters like address, password (if any), and database number. Crucially, it implements connection pooling by default, managing a pool of idle connections to minimize latency when executing commands. Configuration options allow developers to fine-tune the pool size, connection timeouts, and other parameters to optimize performance for their specific workloads. Beyond basic connection management, the client provides methods for executing all standard Redis commands, mirroring the Redis command syntax closely.

The library supports all major Redis data types: strings, hashes, lists, sets, sorted sets, streams, and geospatial indexes. For each data type, go-redis provides convenient methods for performing common operations. For example, `Set`, `Get`, `Incr`, and `Del` for strings; `HSet`, `HGet`, `HGetAll` for hashes; `LPush`, `RPop`, `LRange` for lists, and so on. It also includes support for more advanced Redis features like Pub/Sub messaging, transactions, Lua scripting, and RedisJSON. The API is designed to be intuitive and easy to use, with methods often accepting variadic arguments to accommodate commands with multiple parameters.

A significant strength of go-redis is its support for context propagation. All command execution methods accept a `context.Context` as an argument, allowing for graceful cancellation of operations and propagation of deadlines. This is crucial for building resilient and scalable applications. Furthermore, the library provides robust error handling, returning errors that are easy to inspect and handle. It also supports automatic retries for certain commands, improving reliability in the face of transient network issues. Serialization and deserialization are handled automatically for many common Go data types, simplifying data exchange with Redis.

Beyond the core functionality, go-redis offers several advanced features. It includes support for Redis Cluster, allowing applications to scale horizontally across multiple Redis nodes. It also provides integration with Redis Sentinel for high availability and automatic failover. The library supports Redis Streams with consumer groups, enabling robust and scalable event processing. Finally, go-redis offers a flexible and extensible architecture, allowing developers to customize its behavior through options and hooks. The comprehensive documentation and active community make it a valuable resource for developers building Go applications that leverage the power of Redis.

go-redis
by
redisredis/go-redis

Repository Details

Fetching additional details & charts...