示例#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 HomeController(MenuBLL _menuBLL, UserBLL _userBLL, LogLoginBLL _logLoginBLL,
                       MenuAuthorizeBLL _menuAuthorizeBLL, OperatorCache operatorCache)
 {
     menuBLL          = _menuBLL;
     userBLL          = _userBLL;
     logLoginBLL      = _logLoginBLL;
     menuAuthorizeBLL = _menuAuthorizeBLL;
     _operator        = operatorCache;
 }