** 连接池 **
client := redis.NewClient(&redis.Options{
Addr: "Amazon ElastiCache for Redis ",
Password: "", // no password set
DB: 0, // use default DB
IdleCheckFrequency: 15*time.Second,
IdleTimeout:60*time.Second,
MinIdleConns: 15,
MaxConnAge: 60*time.Second,
})
var RedisCtx = context.Background()
_, err:=client.Exists(RedisCtx,key).Result()
if err!=nil{
//Random reminder connection pool timeout. why?
logs.Warning("exists redis error",err)
}
连接池在使用中偶尔会出现“连接池超时”</p>
redis 使用“用于 Redis 的 Amazon ElastiCache”
谢谢!!