static void TestRedis() { int dbIdx = 4; string key = "testKey"; Task.Run(() => { while (true) { Task.Run(() => { RedisUtils.StringSet(dbIdx, key, DateTime.Now.ToString(), TimeSpan.FromSeconds(30)); }); Task.Run(() => { string v = RedisUtils.StringGet(dbIdx, key); Console.WriteLine("1:" + v); }); System.Threading.Thread.Sleep(100); } }); Task.Run(() => { while (true) { Task.Run(() => { RedisUtils.StringSet(dbIdx, key, DateTime.Now.ToString(), TimeSpan.FromSeconds(30)); }); Task.Run(() => { string v = RedisUtils.StringGet(dbIdx, key); Console.WriteLine("2:" + v); }); System.Threading.Thread.Sleep(100); } }); Task.Run(() => { while (true) { Task.Run(() => { RedisUtils.StringSet(dbIdx, key, DateTime.Now.ToString(), TimeSpan.FromSeconds(30)); }); Task.Run(() => { string v = RedisUtils.StringGet(dbIdx, key); Console.WriteLine("3:" + v); }); System.Threading.Thread.Sleep(100); } }); }