using System;
using System.Collections;
namespace Stat.web.Manager
{

    /// <summary>
    /// 
    /// </summary>
    public partial class ShowCache : System.Web.UI.Page
    {
        Stat.Cache.IRemoveCache myCache = Stat.Cache.CacheFatory.CreateRemoveCache();
        static Stat.Security.ISecurity security = Stat.Security.DataFatory.CreateSecurity();

        string keyword = "";
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            keyword = Plugin.Common.Rq("k").ToLower();

            if (!IsPostBack)
            {
                GetCache(keyword);
            }
        }

        private void GetCache(string keyword)
        {          

            string[] app = Application.AllKeys;
            IDictionaryEnumerator CacheEnum = myCache.GetAllCache();
            int number = 0;
            /*------------------------------------------------------------------------------*/
            if (keyword.ToLower() == "app")
            {
                foreach (string item in app)
                {
                    this.ltrMsg.Text += "<hr style=\" width:98%; text-align:center;\" /><br>";
                    this.ltrMsg.Text += "Application编号：" + (number++) + "<br>";
                    this.ltrMsg.Text += "Application键名：" + item + "<br>";
                    this.ltrMsg.Text += "Application键值：" + Application[item] + "<br>";
                }
            }
            /*------------------------------------------------------------------------------*/
            while (CacheEnum.MoveNext())
            {
                if (CacheEnum.Key.ToString() != "strConnecion")
                {
                    if (CacheEnum.Key.ToString().ToLower().IndexOf(keyword) >= 0)
                    {
                        this.ltrMsg.Text += "<hr style=\" width:98%; text-align:center;\" /><br>";
                        this.ltrMsg.Text += "Cache编号：" + (number++) + "<br>";
                        this.ltrMsg.Text += "Cache键名：" + CacheEnum.Key.ToString() + "<br>";
                        this.ltrMsg.Text += "Cache键值：" + CacheEnum.Value.ToString() + "<br>";
                    }
                }
                else
                {
                    //数据库连接不列出
                }
            }
            /*------------------------------------------------------------------------------*/


        }
    }

}

