public static async void Test2(string key) { Stopwatch sw = new Stopwatch(); sw.Start(); for (int i = 0; i < 10000; i++) { var result = await redis.HSet(key, "hello", new Data.TestData() { name = "hello", age = 18 }); result = await redis.HDel(key, "hello"); } sw.Stop(); Console.WriteLine("Test2Over Time:" + sw.Elapsed); }
public async Task HSetAndDel() { var setResult = await redis.HSet("hello", "18", new TestData() { name = "hello", age = 18 }); Assert.AreEqual(setResult, 1); var getResult = await redis.HGet <TestData>("hello", "18"); Assert.AreEqual(getResult.name, "hello"); var getResult2 = (TestData)await redis.HGet(typeof(TestData), "hello", "18"); Assert.AreEqual(getResult2.name, "hello"); var delResult = await redis.HDel("hello", "18"); Assert.AreEqual(delResult, 1); }