/// <summary> /// Get Read Only Client /// </summary> /// <returns></returns> public static IRedisClient GetReadOnlyClient() { if (IsSentinelMode) { var client = Rcm.GetReadOnlyClient(); if (string.IsNullOrEmpty(SentinelNodePwd)) { client.Password = SentinelNodePwd; } if (IsKeepAliveMode) { int count = 0; while (count <= MaxAllowReGetClient) { if (KeepAliveService.Instance.IsAvaiable(client)) { break; } else { client.Dispose(); client = null; client = Rcm.GetReadOnlyClient(); count++; } } } return(client); } else { IRedisClient client = Prcm.GetReadOnlyClient(); if (IsKeepAliveMode) { int count = 0; while (count <= MaxAllowReGetClient) { if (KeepAliveService.Instance.IsAvaiable(client)) { break; } else { client.Dispose(); client = null; client = Prcm.GetReadOnlyClient(); count++; } } } return(client); } }
/// <summary> /// Get Client /// </summary> /// <returns></returns> public static IRedisClient GetClient() { if (IsSentinelMode) { return(Rcm.GetReadOnlyClient()); } else { return(Prcm.GetClient()); } }