Beispiel #1
0
 public async Task Pub()
 {
     await redis.RedisSubscribe().SubscribeAsync("test", (msg, value) =>
     {
         Console.WriteLine(value);
     });
 }
Beispiel #2
0
 /// <summary>
 /// 订阅加载事件
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public async Task ReloadAsync(object obj)
 {
     await redis.RedisSubscribe().SubscribeAsync(FateConfigurationInfrastructure.SubscribeKey, async(channel, value) =>
     {
         //重新获取数据
         var data = await fateConfigurationLoad.LoadConfiguration().ConfigureAwait(false);
         data.ToList().ForEach(item =>
         {
             configuration[item.Key] = item.Value;
         });
     });
 }
Beispiel #3
0
        public string subTest()
        {
            Action <RedisChannel, RedisValue> handler = (channel, message) =>
            {
                Console.WriteLine(channel);
                Console.WriteLine(message);
            };

            redis.RedisSubscribe().Subscribe("push", handler);

            ////发布
            //redis.Publish("push", "你好");
            return("1");
        }
Beispiel #4
0
 public async Task PublishAsync()
 {
     await redis.RedisSubscribe().PublishAsync(FateConfigurationInfrastructure.SubscribeKey, "更新配置").ConfigureAwait(false);
 }