public RedisService ConnectAsync(ConfigurationOptions config) { Disconnect(); connStat = ConnectionStat.Connecting; taskConnection = ConnectionMultiplexer.ConnectAsync(config) .ContinueWith(v => { try { CurrRedis = null; if (v.IsFaulted) { Debug.LogWarning(v.Exception); } else { CurrRedis = v.Result; } connStat = (CurrRedis != null) ? ConnectionStat.Connected : ConnectionStat.None; } catch (System.Exception e) { Debug.LogWarning(e); } }); return(this); }
public RedisService Disconnect() { if (CurrRedis != null) { CurrRedis.Dispose(); CurrRedis = null; } connStat = ConnectionStat.None; return(this); }
public bool Connect(ConfigurationOptions config) { try { Disconnect(); connStat = ConnectionStat.Connecting; CurrRedis = ConnectionMultiplexer.Connect(config); }catch (System.Exception e) { Debug.LogWarning(e); } var res = CurrRedis != null; connStat = res ? ConnectionStat.Connected : ConnectionStat.None; return(res); }