https://github.com/go-spring/starter-redigo
🔥 [released] redigo 启动器 (starter for redigo)
https://github.com/go-spring/starter-redigo
go-spring redigo redis starter
Last synced: 28 days ago
JSON representation
🔥 [released] redigo 启动器 (starter for redigo)
- Host: GitHub
- URL: https://github.com/go-spring/starter-redigo
- Owner: go-spring
- License: apache-2.0
- Created: 2021-10-22T12:10:20.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2026-03-27T12:05:53.000Z (3 months ago)
- Last Synced: 2026-03-27T23:10:08.553Z (3 months ago)
- Topics: go-spring, redigo, redis, starter
- Language: Go
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# starter-redigo
[English](README.md) | [中文](README_CN.md)
> The project has been officially released, welcome to use!
`starter-redigo` provides a Redis client wrapper based on redigo,
making it easy to integrate and use Redis in Go-Spring applications.
## Installation
```bash
go get github.com/go-spring/starter-redigo
```
## Quick Start
### 1. Import the `starter-redigo` Package
Refer to the [example.go](example/example.go) file.
```go
import _ "github.com/go-spring/starter-redigo"
```
### 2. Configure the Redis Instance
Add Redis configuration in your project’s [configuration file](example/conf/app.properties), for example:
```properties
spring.redigo.main.addr=127.0.0.1:6379
```
### 3. Inject the Redis Instance
Refer to the [example.go](example/example.go) file.
```go
import "github.com/gomodule/redigo/redis"
type Service struct {
Redis *redis.Client `autowire:""`
}
```
### 4. Use the Redis Instance
Refer to the [example.go](example/example.go) file.
```go
str, err := s.Redis.Get(r.Context(), "key").Result()
str, err := s.Redis.Set(r.Context(), "key", "value", 0).Result()
```
## Advanced Features
* **Supports multiple Redis instances**: You can define multiple Redis instances in the configuration file and reference
them by name in your project.
* **Support Redis extensions**: You can extend Redis functionality by implementing the `Driver` interface — see the
example implementation `AnotherRedisDriver`.