//直接打开首页读取缓存数据 public ActionResult IndexDeferLoad() { this.Internationalization(); HomeModel model = Cache.HomeData; if (model == null) { model = new HomeModel(); } return PartialView(model); }
/// <summary> /// 更新首页数据缓存 /// </summary> public static void UpdateHomeData() { lock (HomeDataObj) { AlbumService albumService = new AlbumService(); HomeData data = albumService.GetHomeData(); homeData = new HomeModel(); if (data != null) { homeData.Slides = data.Slides; homeData.NewUploads = data.NewUploads; homeData.RecommendPictures = data.RecommendPictures; //homeData.TopWomen = data.TopWomen; //homeData.TopMen = data.TopMen; homeData.RecommendPure = data.RecommendPure; homeData.RecommendSexy = data.RecommendSexy; homeData.RecommendStar = data.RecommendStar; homeData.RecommendCostume = data.RecommendCostume; homeData.RecommendStylishMan = data.RecommendStylishMan; } } }
/// <summary> /// 更新首页数据缓存 /// </summary> public static void UpdateHomeData() { lock (HomeDataObj) { AlbumService albumService = new AlbumService(); HomeData data = albumService.GetHomeData(); homeData = new HomeModel(); if (data != null) { homeData.Slides = data.Slides; homeData.NewUploads = data.NewUploads; homeData.RecommendPictures = data.RecommendPictures; homeData.TopWomen = data.TopWomen; homeData.TopMen = data.TopMen; homeData.RecommendPure = data.RecommendPure; homeData.RecommendSexy = data.RecommendSexy; homeData.RecommendStar = data.RecommendStar; homeData.RecommendCostume = data.RecommendCostume; homeData.RecommendStylishMan = data.RecommendStylishMan; } //homeData.Slides = albumService.GetAlbumBySlide(); //homeData.NewUploads = albumService.GetAlbumByNew(); //homeData.RecommendPictures = albumService.GetRecommendAlbumByCategoryId("All", 4); //homeData.TopWomen = albumService.GetRecommendAlbumByCategoryId("TopWomen", 7); //homeData.TopMen = albumService.GetRecommendAlbumByCategoryId("TopMen", 7); //homeData.RecommendPure = albumService.GetRecommendAlbumByCategoryId("Pure", 4); //homeData.RecommendSexy = albumService.GetRecommendAlbumByCategoryId("Sexy", 4); //homeData.RecommendStar = albumService.GetRecommendAlbumByCategoryId("Star", 4); //homeData.RecommendCostume = albumService.GetRecommendAlbumByCategoryId("Costume", 4); //homeData.RecommendStylishMan = albumService.GetRecommendAlbumByCategoryId("StylishMan", 4); } }