private void Connect() { Console.WriteLine("reconnect"); while (true) { try { _conn = RedisSeConnection.GetConnection(_host); if (_conn.IsConnected) { Connected = _conn.IsConnected; //_conn.ConnectionFailed += _conn_ConnectionFailed; break; } Thread.Sleep(100); } catch { } } }
public RedisSe(string host, int db = 0) { _host = host; _db = db; try { _conn = string.IsNullOrWhiteSpace(host) ? RedisSeConnection.Instance : RedisSeConnection.GetConnection(host); Connected = _conn.IsConnected; _conn.ConnectionFailed += _conn_ConnectionFailed; } catch (Exception) { new Thread(Connect) { IsBackground = true }.Start(); //throw; } //_conn = string.IsNullOrWhiteSpace(host) ? RedisSeConnection.Instance :RedisSeConnection.GetConnectionMultiplexer(host); }