/// <summary> /// Initializes a new instance of the <see cref="StackExchangeRedisService"/> class. /// </summary> /// <param name="server">服务器信息.</param> /// <param name="password">密码.</param> /// <param name="dbId">数据库Id.</param> public PubSubRedisService(string server, string password) { try { lock (_locker) { _Multiplexer = StackExchangeManager.GetMultiplexer(server, password); if (_Multiplexer != null && _Multiplexer.IsConnected) { _Subscriber = _Multiplexer.GetSubscriber(); } } } catch (Exception ex) { //new ECFException(ex, "Cache-Redis"); } }
/// <summary> /// Initializes a new instance of the <see cref="StackExchangeRedisService"/> class. /// </summary> /// <param name="server">服务器信息.</param> /// <param name="password">密码.</param> /// <param name="dbId">数据库Id.</param> public StackExchangeRedisService(string server, string password, int dbId) { try { lock (_locker) { _serverLocal = server; _DatabaseId = dbId; _Multiplexer = StackExchangeManager.GetMultiplexer(server, password); if (_Multiplexer != null && _Multiplexer.IsConnected) { _Server = _Multiplexer.GetServer(server); _Database = _Multiplexer.GetDatabase(dbId); } } } catch (Exception ex) { //new ECFException(ex, "Cache-Redis"); } }