ReviewR.Web.Infrastructure.CacheControlAttribute.OnActionExecuted C# (CSharp) Method

OnActionExecuted() public method

public OnActionExecuted ( System.Web.Http.Filters.HttpActionExecutedContext actionExecutedContext ) : void
actionExecutedContext System.Web.Http.Filters.HttpActionExecutedContext
return void
        public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
        {
            var cacheControl = actionExecutedContext.Result.Headers.CacheControl;
            if (cacheControl == null)
            {
                cacheControl = actionExecutedContext.Result.Headers.CacheControl = new CacheControlHeaderValue();
            }
            switch (Cacheability)
            {
                case CacheabilityValue.Public:
                    cacheControl.Public = true;
                    break;
                case CacheabilityValue.Private:
                    cacheControl.Private = true;
                    break;
                default:
                    cacheControl.NoCache = true;
                    break;
            }
            cacheControl.NoStore = NoStore;
            cacheControl.SharedMaxAge = SharedMaxAge;
            cacheControl.MaxAge = MaxAge;
            cacheControl.MinFresh = MinFresh;
            cacheControl.MaxStale = MaxStale;
            cacheControl.OnlyIfCached = OnlyIfCached;
            cacheControl.MustRevalidate = MustRevalidate;
            cacheControl.ProxyRevalidate = ProxyRevalidate;
            cacheControl.NoTransform = NoTransform;
            base.OnActionExecuted(actionExecutedContext);
        }