Esempio n. 1
0
        static async Task Pub()
        {
            Console.WriteLine("请输入要发布向哪个通道?");
            var    channelKey = Console.ReadLine();
            string input      = "测试Reddis发布订阅消息";

            Console.WriteLine("正在发送消息");
            while (true)
            {
                //  input = Console.ReadLine();
                _redis.Publish(channelKey, input);
                _redis.Publish("gb", "gb");
                Thread.Sleep(1000);
            }
            //await Task.Delay(10);
            //for (int i = 0; i < 10; i++)
            //{
            //    await _redis.PublishAsync(channel, i.ToString());
            //}
        }