https://github.com/garyburd/redigo
为什么redigo会返回错误消息?
错误信息:
ERR unknown command 'EVALSHA'
ERR unknown command 'EVALSHA'代码:
const lockScript = `
local v = redis.call("GET", KEYS[1])
if v == false or v == ARGV[1]
then
return redis.call("SET", KEYS[1], ARGV[1], "EX", ARGV[2]) and 1
else
return 0
end
`
func CounterRegScript() {
rc := RedisClient.Get()
defer rc.Close()
script := redis.NewScript(1, lockScript)
resp, err := script.Do(rc, "xiaorui.cc", "nima", int64(3))
fmt.Println(resp)
fmt.Println(err)
}发布于 2017-08-16 11:56:52
你使用的是老版本的Redis。升级到2.6版或更高版本。
https://stackoverflow.com/questions/45707915
复制相似问题