OutputCache 属性始终具有先前的持续时间集

OutputCache attribute always has the previous duration set

出于某种原因,输出缓存将我应用于过期事件的两周持续时间保留在未来的事件上。我是否在我的自定义输出提供程序中遗​​漏了一些东西来停止保存持续时间?

[ExpiredOutputCache(Duration = 3600, VaryByParam = "eventid;expired")]
        public virtual ActionResult GetDivisionsViews(int eventId, EventDivisionsViewModel viewModel)
        {

}

    public class ExpiredOutputCacheAttribute : OutputCacheAttribute
        {
            public override void OnActionExecuting(ActionExecutingContext filterContext)
            {
                if((filterContext.HttpContext.Request.QueryString[Config.QueryString.Expired] != null && filterContext.HttpContext.Request.QueryString[Config.QueryString.Expired].To<DateTime>().Date < DateTime.Now.Date.Date) || 
                   (filterContext.RouteData.Values[Config.QueryString.Expired] != null && filterContext.RouteData.Values[Config.QueryString.Expired].To<DateTime>().Date < DateTime.Now.Date.Date))
                {
                    Duration = (int)Config.Cache.TwoWeeks * 60;
                }

                base.OnActionExecuting(filterContext);
            }
        }

我刚刚做了这个。

protected int OriginalDuration { get; set; }

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if(OriginalDuration == 0)
            {
                OriginalDuration = Duration;
            }

            if ((filterContext.HttpContext.Request.QueryString[Config.QueryString.Expired] != null && filterContext.HttpContext.Request.QueryString[Config.QueryString.Expired].To<DateTime>().Date < DateTime.Now.Date.Date) || 
               (filterContext.RouteData.Values[Config.QueryString.Expired] != null && filterContext.RouteData.Values[Config.QueryString.Expired].To<DateTime>().Date < DateTime.Now.Date.Date))
            {
                Duration = (int)Config.Cache.TwoWeeks * 60;
            }
            else
            {
                Duration = OriginalDuration;
            }

            base.OnActionExecuting(filterContext);
        }