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 的一个问题 #11

Closed
fuckqqcom opened this issue Jun 15, 2018 · 4 comments
Closed

请教下关于redis 的一个问题 #11

fuckqqcom opened this issue Jun 15, 2018 · 4 comments

Comments

@fuckqqcom
Copy link

func Set(key string, data interface{}, time int) (bool, error) {
conn := RedisConn.Get()
defer conn.Close()

value, err := json.Marshal(data)
if err != nil {
	return false, err
}

reply, err := redis.Bool(conn.Do("SET", key, value))
conn.Do("EXPIRE", key, time)

return reply, err

}

您好,在这个方法中,conn.Do("SET", key, value) 这个返回一个ok,err ,ok一个字符串“ok”,那这里用redis.Bool()方法不是很合适吧。还是我这边测试的问题

@fuckqqcom
Copy link
Author

image

@eddycjy
Copy link
Owner

eddycjy commented Jun 17, 2018

@xhochipe 感谢反馈,是我这边的代码出现了纰漏

已经修复了 😁

@fuckqqcom
Copy link
Author

没事 @eddycjy ,一直在关注你更新这个,我现在也在你写的基础上自己在学,另外博主这边有木有qq群什么的,可以学习跟你学习

@eddycjy
Copy link
Owner

eddycjy commented Jun 17, 2018

@xhochipe Q 群暂时没有哦,如果有什么问题或想法,欢迎随时在 SF 私信我,或者 Github 上来找我 🤔

其实你这样才是较好实践,因为每个人对知识的理解都不一样,举一反三是最好的学习姿势!

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

2 participants