public OutputCacheController(OutputCacheManager outputCacheTagger)
 {
     _outputCacheManager = outputCacheTagger;
 }
示例#2
0
        public ActionResult ExpireSimpleDonutOneCache()
        {
            OutputCacheManager.RemoveItem("Home", "SimpleDonutOne");

            return(Content("OK", "text/plain"));
        }
        private bool compress = false; //turing off compression

        #endregion Fields

        #region Constructors

        public ChroniclesOutputCacheAttribute()
        {
            cacheManager = new OutputCacheManager();
        }
示例#4
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (string.IsNullOrEmpty(System.Web.HttpContext.Current.User.Identity.Name))
            {
                ContentResult result = new ContentResult {Content = "",ContentType = ""};
                filterContext.Result = result;
            }
            string cacheKey = System.Web.HttpContext.Current.User.Identity.Name  + System.Web.HttpContext.Current.Request.RawUrl;
            if (!string.IsNullOrEmpty(cacheKey))
            {
                var OutputCacheManager = new OutputCacheManager();
                CacheItem item = OutputCacheManager.GetItem(cacheKey);
                if (item == null  )
                {
                    item = new CacheItem { Content = "", ContentType = "StartRequest" };
                    OutputCacheManager.AddItem(cacheKey, item, DateTime.UtcNow.AddSeconds(1800));
                }
                else if(item.ContentType == "RequestError" || (option == 1 && item.ContentType == "FinishRequest")){
                    item.Content = "";
                    item.ContentType = "StartRequest";
                    OutputCacheManager.AddItem(cacheKey, item, DateTime.UtcNow.AddSeconds(1800));
                }
                else if (item.ContentType == "FinishRequest")
                {
                    FilePathResult result = new FilePathResult(ExportCache.FilePath(item.Content), "application/vnd.ms-excel");
                    result.FileDownloadName = item.Content;
                    filterContext.Result = result;
                }
                else
                {
                    int current = 0;
                    if (!string.IsNullOrEmpty(item.Content))
                    {
                        current = int.Parse(item.Content) + 1;
                    }
                    item.Content = current.ToString();
                    OutputCacheManager.AddItem(cacheKey, item, DateTime.UtcNow.AddSeconds(1800));
                    while (item.ContentType == "StartRequest" && item.Content == current.ToString())
                    {
                        System.Threading.Thread.Sleep(5000);
                        item = OutputCacheManager.GetItem(cacheKey);
                    }

                    if (item.ContentType == "FinishRequest" )
                    {
                        FilePathResult result = new FilePathResult(ExportCache.FilePath(item.Content), "application/vnd.ms-excel");
                        result.FileDownloadName = item.Content;
                        filterContext.Result = result;
                    }
                    else if (item.ContentType == "RequestError")
                    {
                        ContentResult result = new ContentResult
                        {
                            Content = "Error when excute request",
                            ContentType = item.ContentType
                        };
                        filterContext.Result = result;
                    }
                    else
                    {
                        ContentResult result = new ContentResult
                        {
                            Content = "",
                            ContentType = item.ContentType
                        };
                        filterContext.Result = result;
                    }
                }
             
            }
        }
示例#5
0
        public static void CacheTopUp()
        {
            var cacheManager = new OutputCacheManager();

            cacheManager.RemoveItems("TopUpMonitoring", "Read");
        }
示例#6
0
        public static void CachePromptedPersonal()
        {
            var cacheManager = new OutputCacheManager();

            cacheManager.RemoveItems("PromptedPersonal", "PromptedPersonals_Read");
        }
示例#7
0
        public static void CacheDashboardSCE()
        {
            var cacheManager = new OutputCacheManager();

            cacheManager.RemoveItems("DBOrderFulfillment");
        }
示例#8
0
        public static void CacheTelesalesKPI()
        {
            var cacheManager = new OutputCacheManager();

            cacheManager.RemoveItems("TelesalePluginCode", "_KPIAndActualForTelesale");
        }
示例#9
0
        public static void CacheCustomer()
        {
            var cacheManager = new OutputCacheManager();

            cacheManager.RemoveItems("Customer", "Customer_ReadAll");
        }
示例#10
0
        public static void CacheOrgazanitionPDSupport()
        {
            var cacheManager = new OutputCacheManager();

            cacheManager.RemoveItems("Organization", "Organization_Read");
        }
示例#11
0
        private static void RemoveItemsFromCache()
        {
            var cacheManager = new OutputCacheManager();

            cacheManager.RemoveItems();
        }
        public ActionResult ExpireAreaDonuts()
        {
            OutputCacheManager.RemoveItems(null, null, new { area = "SubArea" });

            return(Content("OK", "text/plain"));
        }
        public ActionResult ExpireAreaDonutOne()
        {
            OutputCacheManager.RemoveItem("SubHome", "AreaDonutOne", new { area = "SubArea" });

            return(Content("OK", "text/plain"));
        }