/// <summary> /// CacheQueue的清理方法 /// </summary> private static void ScavengeCache() { while (true) { try { //清理周期,在配置文件中进行设置 Thread.Sleep(CacheSettingsSection.GetConfig().ScanvageInterval); InternalScavenge(); } catch (ThreadAbortException) { } catch (System.Exception ex) { ex.WriteToEventLog("ScavengeCache"); //避免死循环,长期占用CPU Thread.Sleep(500); } finally { CacheManager.InScavengeThread = false; } } }
/// <summary> /// 获取Cache的配置信息 /// </summary> /// <returns>Cache的配置信息</returns> public static CacheSettingsSection GetConfig() { CacheSettingsSection result = (CacheSettingsSection)ConfigurationBroker.GetSection("cacheSettings"); if (result == null) result = new CacheSettingsSection(); return result; }
/// <summary> /// 获取Cache的配置信息 /// </summary> /// <returns>Cache的配置信息</returns> public static CacheSettingsSection GetConfig() { CacheSettingsSection result = (CacheSettingsSection)ConfigurationBroker.GetSection("cacheSettings"); if (result == null) { result = new CacheSettingsSection(); } return(result); }
private void context_BeginRequest(object sender, EventArgs e) { //CheckAndExecuteScavenge(); if (CacheSettingsSection.GetConfig().EnableCacheInfoPage) { if (HttpContext.Current.Request.Url.ToString().LastIndexOf("DeluxeCacheInfo.axd", StringComparison.OrdinalIgnoreCase) >= 0) { HttpContext.Current.Response.ContentEncoding = Encoding.UTF8; if (HttpContext.Current.Request.HttpMethod.ToUpper() == "POST") { ClearCacheQueue(HttpContext.Current.Request.Form["cacheQueueTypeName"]); } ShowCacheInfo(); HttpContext.Current.Response.End(); } } }