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

文中的demo会报错 #2

Closed
kacha886 opened this issue Jun 12, 2022 · 1 comment
Closed

文中的demo会报错 #2

kacha886 opened this issue Jun 12, 2022 · 1 comment

Comments

@kacha886
Copy link

func main() {
client := redis.NewClient(&redis.Options{
Network: "tcp",
Addr: "127.0.0.1:6379",
DB: 0,
})

rc := rockscache.NewClient(client, rockscache.NewDefaultOptions())
v, err := rc.Fetch("key2", 400, func() (string, error) {
	return "value2", nil
})
if err != nil {
	fmt.Println(err)
	return
}
fmt.Println(v)

}
key2的值为"aaa",获取时报下面的错误
ERR Error running script (call to f_a307994a908d94d53a2b772ddc6cf08109e0a828): @user_script:2: WRONGTYPE Operation against a key holding the wrong kind of value

@yedf2
Copy link
Contributor

yedf2 commented Jun 13, 2022

key2的值,或者为空,或者为hash,而不是string。你可以删掉key2,重新运行一下

@yedf2 yedf2 closed this as completed Jul 22, 2022
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