我在 Google App engine Go Runtime 上使用 Redis Cloud 服务(来自 Redis Labs),当我尝试获取不存在的密钥时出现上述错误。该代码在本地测试服务器上运行良好,但在生产中出现恐慌。
c, err := redis.Dial("tcp", "pub-redis-myredis:<myport>")
_, err = c.Do("AUTH", "password")
value, err := c.Do("GET", "foo4")
if value == nil {
log.Infof(contextOfAppEngineWhereServerIsRunning, "value not found in redislabs")
}
日志显示panic在行_, err = c.Do("AUTH", "password")