コード例 #1
0
        static async Task LockExecuteTestAsync()
        {
            const string channel = "message";
            const string message = "hi there";
            await redis.PublishAsync(channel, message);

            Console.WriteLine($" msg has been send channel: {channel} msg:{message} \t{DateTime.Now.ToLongTimeString()}");
        }
コード例 #2
0
        public async Task PubSubTestAsync()
        {
            const string channel = "message";
            const string message = "hi there";

            await _redis.SubscribeAsync(channel, (chn, msg) =>
            {
                Assert.Equal(channel, chn);
                Assert.Equal(message, msg);
            });

            await _redis.PublishAsync(channel, message);
        }