示例#1
0
        /// <summary>
        /// Delegated event handler method is executed when the page is loaded through the PageLoad event
        /// to collect input data as set in query string and find appropriate cache item.
        /// </summary>
        /// <param name="sender">The object that sent the event.</param>
        /// <param name="e">The event arguments.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                SecurityContext.Demand(new UseCacheViewerRight(), true);
                if (!Page.IsPostBack)
                {
                    scopeDropDownList.Items.Add(new ListItem("AppDomain"));
                    scopeDropDownList.Items.Add(new ListItem("Thread"));
                }

                _cacheName = Request.QueryString["name"];
                _keyName   = Request.QueryString["ItemKey"];
                _scopeName = Request.QueryString["scope"];
                if ((_scopeName != null) && (_cacheName != null))
                {
                    IList scopeCaches = CacheFactory.GetCaches(CacheScope.AppDomain);
                    foreach (ICache scopeCache in scopeCaches)
                    {
                        if (scopeCache.Name.Equals(_cacheName))
                        {
                            _selectedCache = scopeCache;
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error(string.Format("CacheControl: Error getting cache {0} of scope {1}: {2}",
                                         _cacheName, _scopeName, ex));
                throw ex;
            }
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        protected void ReadData()
        {
            ArrayList allCaches = new ArrayList();

            allCaches.AddRange(CacheFactory.GetCaches(CacheScope.AppDomain));
            allCaches.AddRange(CacheFactory.GetCaches(CacheScope.Thread));
            allCaches.Sort(new CacheComparer());
            cachesRepeater.DataSource = allCaches;
            cachesRepeater.DataBind();
        }