Пример #1
0
 private static void Start(string name, Action <string, string> handleAction)
 {
     using (var client = RedisManager.GetClient())
     {
         //LogHelper.Info("创建频道连接",OpType.System);
         Subscription = client.CreateSubscription();
         //Subscription.OnUnSubscribe = channel =>
         //    LogHelper.Info("停止监听: " + channel, OpType.System);
         Subscription.OnMessage = (channel, msg) =>
         {
             if (msg == "STOP")
             {
                 //LogHelper.Info("断开所有监听频道...",OpType.System);
                 Subscription.UnSubscribeFromAllChannels(); //Un block thread.
                 return;
             }
             handleAction(channel, msg);
         };
         //LogHelper.Info("开始监听:" + name,OpType.System);
         Subscription.SubscribeToChannels(name);
     }
 }
Пример #2
0
 protected RedisOperatorBase(long _redisdb)
 {
     Redis = RedisManager.GetClient(_redisdb);
 }
Пример #3
0
 protected RedisOperatorBase()
 {
     Redis = RedisManager.GetClient();
 }