StackExchange.Redis.RedisTimeoutException:"Timeout performing SETEX HotelInfo, inst: 1, queue: 2, qu: 0, qs: 2, qc: 0, wr: 1, wq: 1, in: 0, ar: 0, clientName: CTExternalStandard.API, serverEndpoint: 192.168.1.1:6379, keyHashSlot: 2129 (Please take a look at this article for some common client-side issues that can cause timeouts:
如果redis 频繁报超时,StackExchange.Redis
中的ConnectTimeout
, ResponseTimeout
, 和SyncTimeout 这三个时间显示的指定一下,
cs
ConfigurationOptions redisConfigOption = new ConfigurationOptions();
redisConfigOption.EndPoints.Add(GetAppSetings.RedisServiceName);
redisConfigOption.AllowAdmin = false;
redisConfigOption.Password = GetAppSetings.RedisPassword;
redisConfigOption.ClientName = GetAppSetings.RedisClientName;
redisConfigOption.ConnectTimeout = 60000;
redisConfigOption.ResponseTimeout = 60000;
redisConfigOption.SyncTimeout = 60000;
var conn = ConnectionMultiplexer.Connect(redisConfigOption);
services.AddSingleton<ConnectionMultiplexer>(conn);
这样我都设置成了一分钟。然后重新跑一下代码就可以了