public static string GetPageContent(ManagementPage page) { initialize(); string cacheKey = String.Concat("$MP_", ((int)page).ToString()); return(CacheFactory.Sington.GetResult <String>( cacheKey, () => { string pageContent = null; string pagePath = null; pageSrcs.TryGetValue(page, out pagePath); if (pagePath == null || pagePath.Trim() == String.Empty) { throw new Exception("页面不存在,PAGE:" + page.ToString()); } pagePath = Cms.PyhicPath + pagePath; pageContent = File.ReadAllText(pagePath); HttpRuntime.Cache.Insert( cacheKey, pageContent, new CacheDependency(pagePath), DateTime.Now.AddHours(1), TimeSpan.Zero ); return pageContent; } )); }
public static string GetPageContent(ManagementPage page) { var pagePath = GetPageUrl(page); if (pagePath == null || pagePath.Trim() == string.Empty) { throw new Exception("页面不存在,PAGE:" + page.ToString()); } pagePath = Cms.PhysicPath + pagePath; return(File.ReadAllText(pagePath)); }
public static string GetPageContent(ManagementPage page) { initialize(); string cacheKey = String.Concat("$MP_", ((int)page).ToString()); return CacheFactory.Sington.GetResult<String>( cacheKey, () => { string pageContent = null; string pagePath = null; pageSrcs.TryGetValue(page, out pagePath); if (pagePath == null || pagePath.Trim() == String.Empty) { throw new Exception("页面不存在,PAGE:" + page.ToString()); } pagePath = Cms.PyhicPath + pagePath; pageContent = File.ReadAllText( pagePath); HttpRuntime.Cache.Insert( cacheKey, pageContent, new CacheDependency(pagePath), DateTime.Now.AddHours(1), TimeSpan.Zero ); return pageContent; } ); }