-
Notifications
You must be signed in to change notification settings - Fork 701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for go-redis/v8 #507
Conversation
54cc234
to
b90b48d
Compare
sum(client_stats_gauge{job="appname" ,type="redis",index="idle_conns"})by(name) |
Codecov Report
@@ Coverage Diff @@
## master #507 +/- ##
==========================================
+ Coverage 46.56% 50.82% +4.25%
==========================================
Files 105 106 +1
Lines 6859 6808 -51
==========================================
+ Hits 3194 3460 +266
+ Misses 3415 3092 -323
- Partials 250 256 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
可以直接把redis替换掉 @papa-hexuan |
pkg/client/redisgo/init.go
Outdated
"time" | ||
|
||
prome "github.com/douyu/jupiter/pkg/core/metric" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
|
||
"github.com/douyu/jupiter/pkg/server/governor" | ||
jsoniter "github.com/json-iterator/go" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt
go.mod
Outdated
@@ -9,14 +9,13 @@ require ( | |||
github.com/alicebob/miniredis/v2 v2.23.0 | |||
github.com/apache/rocketmq-client-go/v2 v2.1.1 | |||
github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 | |||
github.com/coocood/freecache v1.2.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge下master分支
go.mod
Outdated
gorm.io/gorm v1.24.0 | ||
) | ||
|
||
require ( | ||
github.com/coocood/freecache v1.2.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require可以合并下
pkg/client/redisgo/client.go
Outdated
} | ||
|
||
// Singleton 单例模式 | ||
func (config *Config) Singleton() *Client { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果出错会panic,可以叫MustSingleton
pkg/client/redisgo/client.go
Outdated
} | ||
|
||
// Build .. | ||
func (config *Config) Build() *Client { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里可以是MustBuild
pkg/client/redisgo/client_test.go
Outdated
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
var addr = "10.1.104.19:6740" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
测试redis用localhost,github上有跑一个本地的redis服务
pkg/client/redisgo/config_test.go
Outdated
dialTimeout="2s" | ||
readTimeout="5s" | ||
idleTimeout="60s" | ||
username="" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix ident
Describe what this PR does / why we need it
Does this pull request fix one issue?
Describe how you did it
Describe how to verify it
Special notes for reviews