コード例 #1
0
ファイル: PubSubRedisService.cs プロジェクト: tynr426/ict
 /// <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");
     }
 }
コード例 #2
0
 /// <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");
     }
 }