最近总出现System.TimeoutException: [r-bp1xxxxxxxxxx.redis.rds.aliyuncs.com:6379/0] ObjectPool.Get() timeout 10 seconds, see: https://github.com/dotnetcore/FreeSql/discussions/1081
单例模式 static Lazy<RedisClient> _cliLazy = new Lazy<RedisClient>(() => { RedisClient _database;= new RedisClient($"{masterhost},password={password}"); _database.Serialize = obj => JsonConvert.SerializeObject(obj); _database.Deserialize = (json, type) => JsonConvert.DeserializeObject(json, type); //_database.Notice += _database_Notice; return _database; }); static RedisClient Instance => _cliLazy.Value; 访问量似乎也没有那么大,没啥特殊的用处,也就是缓存,感觉不至于挂掉 .net 4.8 1.5.3.0 基本是卡死在这里 public static TB_S_SysConfigModel GetBaseModel(int sysid = 1) { TB_S_SysConfigModel configModel = CacheHelper.Get<TB_S_SysConfigModel>(cacheKey); if (configModel == null) { configModel = TB_S_SysConfigDAL.GetBaseModel(sysid); CacheHelper.Set(cacheKey, configModel); } return configModel; }
这个错误大概率是用错了,单例+max pool size 不要用 GetDatabase