Esempio n. 1
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="dbNum">数据库编号</param>
 /// <param name="readWriteHosts">链接地址</param>
 public RedisHelper(int dbNum, string readWriteHosts)
 {
     this.DbNum  = dbNum;
     this._conn  = string.IsNullOrWhiteSpace(readWriteHosts) ? RedisConnectionHelper.Instance : RedisConnectionHelper.GetConnectionMultiplexer(readWriteHosts);
     _serializer = new DefaultRedisCacheSerializer();
 }
Esempio n. 2
0
        public static IServer GetRedisServer(string readWriteHosts)
        {
            string hostAndPort = readWriteHosts.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)[0];

            return(RedisConnectionHelper.GetConnectionMultiplexer(readWriteHosts).GetServer(hostAndPort));
        }