using FreeRedis; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WCS.DebugTool { class Program { static void Main(string[] args) { RedisClient redis = null; while (true) { if (redis == null) { Console.WriteLine("请输入订阅关键字(逗号分隔):"); redis = new RedisClient(Properties.Settings.Default.Redis); var key = Console.ReadLine(); var arr = key.Split(','); redis.PSubscribe(arr, (channel, msg) => { Console.Write(string.Format("对象:{0};", channel)); Console.WriteLine(string.Format("消息:{0}", msg)); }); } else { if (Console.ReadKey().Key == ConsoleKey.Escape) { Console.Clear(); redis.Dispose(); redis = null; } } } } } }