File tree Expand file tree Collapse file tree 1 file changed +15
-13
lines changed
DevTrends.MvcDonutCaching Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -79,20 +79,22 @@ public override void OnActionExecuting(ActionExecutingContext filterContext)
79
79
80
80
filterContext . HttpContext . Response . Output = originalWriter ;
81
81
82
- if ( ! hasErrors )
82
+ if ( hasErrors )
83
83
{
84
- var cacheItem = new CacheItem
85
- {
86
- Content = cachingWriter . ToString ( ) ,
87
- ContentType = filterContext . HttpContext . Response . ContentType
88
- } ;
89
-
90
- filterContext . HttpContext . Response . Write ( _donutHoleFiller . RemoveDonutHoleWrappers ( cacheItem . Content , filterContext ) ) ;
91
-
92
- if ( _cacheSettings . IsServerCachingEnabled && filterContext . HttpContext . Response . StatusCode == 200 )
93
- {
94
- _outputCacheManager . AddItem ( cacheKey , cacheItem , DateTime . UtcNow . AddSeconds ( _cacheSettings . Duration ) ) ;
95
- }
84
+ return ;
85
+ }
86
+
87
+ var cacheItem = new CacheItem
88
+ {
89
+ Content = cachingWriter . ToString ( ) ,
90
+ ContentType = filterContext . HttpContext . Response . ContentType
91
+ } ;
92
+
93
+ filterContext . HttpContext . Response . Write ( _donutHoleFiller . RemoveDonutHoleWrappers ( cacheItem . Content , filterContext ) ) ;
94
+
95
+ if ( _cacheSettings . IsServerCachingEnabled && filterContext . HttpContext . Response . StatusCode == 200 )
96
+ {
97
+ _outputCacheManager . AddItem ( cacheKey , cacheItem , DateTime . UtcNow . AddSeconds ( _cacheSettings . Duration ) ) ;
96
98
}
97
99
} ) ;
98
100
}
You can’t perform that action at this time.
0 commit comments