/// <summary> /// 构造函数 /// </summary> /// <param name="dbNum">数据库编号</param> /// <param name="readWriteHosts">链接地址</param> public RedisHelper(int dbNum, string readWriteHosts) { int num = ConfigHelper.GetValue("RedisDbNum").TryToInt32(); if (num > 0 && dbNum == 0) { this.DbNum = num; } else { this.DbNum = dbNum; } this._conn = string.IsNullOrWhiteSpace(readWriteHosts) ? RedisConnectionHelper.Instance : RedisConnectionHelper.GetConnectionMultiplexer(readWriteHosts); }
public static IServer GetRedisServer(string readWriteHosts) { string hostAndPort = readWriteHosts.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)[0]; return(RedisConnectionHelper.GetConnectionMultiplexer(readWriteHosts).GetServer(hostAndPort)); }