private static void ShowCacheInfo() { CacheQueueInfoCollection queues = CacheManager.GetAllCacheInfo(); string template = GetPageTemplate(); template = template.Replace("$Summary$", GetSummary(queues)); string queuesInfo = GetAllQueueInfo(queues); template = template.Replace("$QueueInfoLines$", GetAllQueueInfo(queues)); HttpContext.Current.Response.Write(template); }
private static string GetAllQueueInfo(CacheQueueInfoCollection queues) { StringBuilder strB = new StringBuilder(); using (TextWriter sw = new StringWriter(strB)) { HtmlTextWriter writer = new HtmlTextWriter(sw); foreach (CacheQueueInfo queueInfo in queues) { RenderQueueInfo(writer, queueInfo); } return(strB.ToString()); } }
private static string GetSummary(CacheQueueInfoCollection queues) { StringBuilder strB = new StringBuilder(); using (TextWriter sw = new StringWriter(strB)) { HtmlTextWriter writer = new HtmlTextWriter(sw); if (queues.Count > 0) { writer.Write("(总共{0}个缓存队列)", queues.Count); RenderCacheQueueClearButton(writer, "ClearAllCache"); } } return(strB.ToString()); }
/// <summary> /// 获得所有Cache队列的信息 /// </summary> /// <returns></returns> public static CacheQueueInfoCollection GetAllCacheInfo() { CacheQueueInfoCollection result = new CacheQueueInfoCollection(); lock (((IDictionary)CacheManager.innerCacheQueues).SyncRoot) { foreach (KeyValuePair <Type, CacheQueueBase> kp in CacheManager.innerCacheQueues) { CacheQueueInfo queueInfo = new CacheQueueInfo(); queueInfo.QueueTypeName = kp.Key.FullName; queueInfo.QueueTypeFullName = kp.Key.AssemblyQualifiedName; queueInfo.Count = kp.Value.Count; result.Add(queueInfo); } } return(result); }
private static string GetAllQueueInfo(CacheQueueInfoCollection queues) { StringBuilder strB = new StringBuilder(); using (TextWriter sw = new StringWriter(strB)) { HtmlTextWriter writer = new HtmlTextWriter(sw); foreach (CacheQueueInfo queueInfo in queues) RenderQueueInfo(writer, queueInfo); return strB.ToString(); } }
private static string GetSummary(CacheQueueInfoCollection queues) { StringBuilder strB = new StringBuilder(); using (TextWriter sw = new StringWriter(strB)) { HtmlTextWriter writer = new HtmlTextWriter(sw); if (queues.Count > 0) { writer.Write("(总共{0}个缓存队列)", queues.Count); RenderCacheQueueClearButton(writer, "ClearAllCache"); } } return strB.ToString(); }