Skip to content
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

建议:给 redis 增加一个使用外部连接的接口 #86

Closed
cool222 opened this issue Sep 19, 2018 · 3 comments
Closed

建议:给 redis 增加一个使用外部连接的接口 #86

cool222 opened this issue Sep 19, 2018 · 3 comments

Comments

@cool222
Copy link

cool222 commented Sep 19, 2018

可以给 cache/redis.go 增加一个指定Redis 对象的方法,由项目统一配置和管理,就不需要组件单独连接了。
//NewRedis 实例化
func SetRedis(pool *redis.Pool) *Redis {
return &Redis{pool}
}

@silenceper
Copy link
Owner

是可以的

@pigLoveRabbit520
Copy link

@cool222

myCache := &wechatCache.Redis{}
myCache.SetConn(cache.GetPool())

这样不就行了

@silenceper
Copy link
Owner

已经有了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants