Exemple #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("开启数据库还原服务!");
            var db = new RepositoryFactory();

            while (true)
            {
                try
                {
                    // 数据库还原
                    string strSql = " ALTER DATABASE LearunFramework_Base_61 SET OFFLINE WITH ROLLBACK IMMEDIATE ";
                    strSql += " RESTORE DATABASE LearunFramework_Base_61 FROM DISK = 'D:\\database61.bak' WITH  NOUNLOAD, REPLACE, STATS = 10 ";
                    strSql += " ALTER database LearunFramework_Base_61 set online ";

                    db.BaseRepository().ExecuteBySql(strSql);

                    // 缓存还原
                    ICache cache = CacheFactory.CaChe();
                    for (int i = 0; i < 16; i++)
                    {
                        cache.RemoveAll(i);
                    }

                    Console.WriteLine("成功还原一次!【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "】");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("失败!【" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "】:" + ex.ToString());
                }
                Thread.Sleep(6000 * 60 * 2);
            }
        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        /// <param name="keyValue"></param>
        public void Modify(int?keyValue)
        {
            this.id = keyValue;
            string cacheKey = "ReviceTask" + keyValue.ToString();

            CacheFactory.CaChe().Remove(cacheKey, 7L);
        }
Exemple #3
0
        public void Modify(int?keyValue)
        {
            id = keyValue;
            int?   num      = keyValue;
            string cacheKey = "UserInfo" + num.ToString();

            CacheFactory.CaChe().Remove(cacheKey, 7L);
        }
        public void ByRedisGetGoodsCode(string code)
        {
            ICache redisCache = CacheFactory.CaChe();
            var    userId     = LoginUserInfo.Get().userId;
            var    key        = userId + "_GoodsCode";

            redisCache.Write(key, code);
        }
Exemple #5
0
        /// <summary>
        /// 启动应用程序
        /// </summary>
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            // 启动的时候清除全部缓存
            ICache cache = CacheFactory.CaChe();

            cache.RemoveAll(6);
        }
Exemple #6
0
        public ActionResult GetTest()
        {
            TestService.Add(new Model.Test {
                Name = "dd", Test1 = "131333", ID = Guid.NewGuid().ToString()
            });

            var    data  = TestService.GetModels(p => true);
            ICache cache = CacheFactory.CaChe();

            cache.Write("TestData", "aaaaaaaaaaaaaaaaaaaaa", 0);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        public ActionResult ByCodeGetStockEntity(string code)
        {
            var stockEntity = toosIBLL.ByCodeGetStockEntity(code);

            ICache redisCache = CacheFactory.CaChe();
            var    userId     = LoginUserInfo.Get().userId;
            var    key        = userId + "_stock";

            if (!code.IsEmpty())
            {
                redisCache.Write(key, stockEntity.S_Code);
            }
            return(Success(stockEntity));
        }
Exemple #8
0
        /// <summary>
        /// 启动应用程序
        /// </summary>
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            // 启动的时候清除全部缓存
            ICache cache = CacheFactory.CaChe();

            cache.RemoveAll(0);
            cache.RemoveAll(1);
            cache.RemoveAll(2);

            cache.RemoveAll(5);
            cache.RemoveAll(6);
            ;
            ModifyInMemory_Spire.ActivateMemoryPatching();
        }
Exemple #9
0
        /// <summary>
        /// 启动应用程序
        /// </summary>
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            // 启动的时候清除全部缓存
            ICache cache = CacheFactory.CaChe();

            cache.RemoveAll(6);

            WfJobScheduler.Start();
            QuartzHelper.InitJob();
            #region 队列处理示例
            //ThreadPool.QueueUserWorkItem(o =>
            //{
            //    while (true)
            //    {
            //        if (cache.ListLength("TicketQueue") > 50)
            //        {
            //            cache.Remove("TicketQueue");
            //        }
            //        if (cache.ListLength("BuyQueue") > 0)
            //        {
            //            Random rd = new Random();
            //            int carNo = rd.Next(10, 18);
            //            string[] seat = { "A", "B", "C", "D", "E", "F" };
            //            Buyer buyer = cache.ListRightPop<Buyer>("BuyQueue");
            //            //写入车票队列
            //            cache.ListLeftPush("TicketQueue", new { name = buyer.name, id = buyer.id, ticketdate = DateTime.Now.AddDays(3).ToString("yyyy-MM-dd HH:mm"), code = carNo + "车" + (carNo / 2).ToString() + seat[rd.Next(0, 6)] });
            //            Thread.Sleep(1000);//假装处理这个业务花了1毫秒
            //        }
            //        else
            //        {
            //            Thread.Sleep(3000);//防止CPU空转
            //        }

            //        if (cache.ListLength("BuyQueue") > 10)
            //        {
            //            cache.Remove("BuyQueue");
            //        }
            //    }
            //});
        }
        /// <summary>
        /// 启动应用程序
        /// </summary>
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            // 启动的时候清除全部缓存
            ICache cache = CacheFactory.CaChe();

            cache.RemoveAll(0);
            cache.RemoveAll(1);
            cache.RemoveAll(2);

            cache.RemoveAll(5);
            cache.RemoveAll(6);
            ModifyInMemory.ActivateMemoryPatching();
            //var actions = ControllerHelper.GetALLPageByReflection();
            //foreach (var item in actions)
            //{
            //    Debug.WriteLine(item);
            //}
        }