示例#1
0
        private void ProcessOutputCache(RequestContext requestContext)
        {
            if (HttpContext.Current == null)
            {
                return;
            }

            var user = requestContext.HttpContext.User;

            if (user == null || user.Identity.IsAuthenticated)
            {
                return;
            }

            ICacheManager cacheManager = RouteExtensions.ResolveService <ICacheManager>(requestContext.RouteData);

            if (adhereToConfig && !cacheManager.Enabled)
            {
                return;
            }

            var page = new OutputCachedPage(cacheManager.GetOutputCacheParameters());

            page.ProcessRequest(HttpContext.Current);
            cacheManager.AddCacheInvalidation(HttpContext.Current.Response);
        }
示例#2
0
        /// <summary>Applies configured cache parameters to this page.</summary>
        protected virtual void ApplyCaching()
        {
            ICacheManager cacheManager = Engine.Resolve <ICacheManager>();

            if (cacheManager.Enabled)
            {
                InitOutputCache(cacheManager.GetOutputCacheParameters());
                cacheManager.AddCacheInvalidation(Response);
            }
        }