sys_cache.aspx.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*******************************************************************************
  2. * iNethinkCMS - 网站内容管理系统
  3. * Copyright (C) 2012-2013 inethink.com
  4. *
  5. * @author jackyang <69991000@qq.com>
  6. * @website http://cms.inethink.com
  7. * @version 1.3.6.0 (2013-08-14)
  8. *
  9. * This is licensed under the GNU LGPL, version 3.0 or later.
  10. * For details, see: http://www.gnu.org/licenses/gpl-3.0.html
  11. *******************************************************************************/
  12. using System;
  13. using System.Collections.Generic;
  14. using System.Data;
  15. using System.Web;
  16. using System.Web.UI;
  17. using System.Web.UI.WebControls;
  18. using System.Web.Caching;
  19. using iNethinkCMS.Command;
  20. using iNethinkCMS.Web.UI;
  21. namespace iNethinkCMS.Web.admin.sys
  22. {
  23. public partial class sys_cache : Admin_BasePage
  24. {
  25. private string vNavInfo = "当前位置:";
  26. private string vAct = "";
  27. protected void Page_Load(object sender, EventArgs e)
  28. {
  29. CheckUserPower("login");
  30. vAct = Request.QueryString["Act"] != null ? Request.QueryString["Act"] : "";
  31. this.navInfoID.InnerText = vNavInfo + "系统缓存管理";
  32. switch (vAct)
  33. {
  34. case "clearcache":
  35. Web.UI.WebUI_Function.Fun_CacheDel();
  36. Response.Redirect("sys_cache.aspx");
  37. break;
  38. default:
  39. Fun_CacheList();
  40. break;
  41. }
  42. }
  43. private void Fun_CacheList()
  44. {
  45. DataTable dt = new DataTable("Datas");
  46. dt.Columns.Add("ID", Type.GetType("System.Int32"));
  47. dt.Columns.Add("CacheName", Type.GetType("System.String"));
  48. dt.Columns.Add("CacheInfo", Type.GetType("System.String"));
  49. int i = 0;
  50. string vCacheKey = siteConfig.CacheKey;
  51. System.Collections.IDictionaryEnumerator CacheEnum = HttpRuntime.Cache.GetEnumerator();
  52. while (CacheEnum.MoveNext())
  53. {
  54. if (Command.Command_StringPlus.Left(CacheEnum.Key.ToString(), vCacheKey.Length) == vCacheKey)
  55. {
  56. i++;
  57. dt.Rows.Add(new object[] { i, CacheEnum.Key, CacheEnum.Value.ToString().Length });
  58. }
  59. }
  60. Repeater.DataSource = dt;
  61. Repeater.DataBind();
  62. this.iNoInfo.Visible = dt.Rows.Count == 0 ? true : false;
  63. }
  64. }
  65. }