コード例 #1
0
        public async Task TestRedisPerformance()
        {
            LogLoginBLL logLoginBLL = new LogLoginBLL();
            var         obj         = await logLoginBLL.GetList(null);

            string    key = "test_performance_key";
            Stopwatch sw  = new Stopwatch();

            sw.Start();
            CacheFactory.Cache.SetCache <List <LogLoginEntity> >(key, obj.Data);
            sw.Stop();
            Console.WriteLine(nameof(TestRedisPerformance) + " Redis Write Time:" + sw.ElapsedMilliseconds + " ms");

            sw.Restart();
            var result = CacheFactory.Cache.GetCache <List <LogLoginEntity> >(key);

            sw.Stop();
            if (obj.Data.Count == result.Count)
            {
                Console.WriteLine(nameof(TestRedisPerformance) + " Redis Read Time:" + sw.ElapsedMilliseconds + " ms");
            }
            else
            {
                Assert.Fail(nameof(TestRedisPerformance));
            }
        }
コード例 #2
0
        public async Task <IActionResult> GetListJson(LogLoginListParam param)
        {
            TData <List <LogLoginEntity> > obj = await logLoginBLL.GetList(param);

            return(Json(obj));
        }