@@ -16,17 +16,16 @@ public class DonutOutputCacheAttribute : ActionFilterAttribute, IExceptionFilter
1616 private readonly IKeyGenerator _keyGenerator ;
1717 private readonly IExtendedOutputCacheManager _outputCacheManager ;
1818 private CacheSettings _cacheSettings ;
19- private bool ? _ignorePostData ;
20- private bool ? _ignoreQueryStringData ;
2119 private bool ? _noStore ;
20+ private OutputCacheOptions ? _options ;
2221
2322 public DonutOutputCacheAttribute ( )
2423 {
2524 var keyBuilder = new KeyBuilder ( ) ;
2625
2726 _keyGenerator = new KeyGenerator ( keyBuilder ) ;
28- _donutHoleFiller = new DonutHoleFiller ( new EncryptingActionSettingsSerialiser ( new ActionSettingsSerialiser ( ) , new Encryptor ( ) ) ) ;
2927 _outputCacheManager = new OutputCacheManager ( OutputCache . Instance , keyBuilder ) ;
28+ _donutHoleFiller = new DonutHoleFiller ( new EncryptingActionSettingsSerialiser ( new ActionSettingsSerialiser ( ) , new Encryptor ( ) ) ) ;
3029 _cacheSettingsManager = new CacheSettingsManager ( ) ;
3130 _cacheHeadersHelper = new CacheHeadersHelper ( ) ;
3231
@@ -94,27 +93,15 @@ public bool NoStore
9493 }
9594 }
9695
97- public bool IgnoreQueryStringData
98- {
99- get
100- {
101- return _ignoreQueryStringData ?? false ;
102- }
103- set
104- {
105- _ignoreQueryStringData = value ;
106- }
107- }
108-
109- public bool IgnorePostData
96+ public OutputCacheOptions Options
11097 {
11198 get
11299 {
113- return _ignorePostData ?? false ;
100+ return _options ?? OutputCacheOptions . None ;
114101 }
115102 set
116103 {
117- _ignorePostData = value ;
104+ _options = value ;
118105 }
119106 }
120107
@@ -228,14 +215,13 @@ protected CacheSettings BuildCacheSettings()
228215 {
229216 cacheSettings = new CacheSettings
230217 {
231- IsCachingEnabled = _cacheSettingsManager . IsCachingEnabledGlobally ,
232- Duration = Duration ,
233- VaryByCustom = VaryByCustom ,
234- VaryByParam = VaryByParam ,
235- Location = ( int ) Location == - 1 ? OutputCacheLocation . Server : Location ,
236- NoStore = NoStore ,
237- IgnorePostData = IgnorePostData ,
238- IgnoreQueryStringData = IgnoreQueryStringData ,
218+ IsCachingEnabled = _cacheSettingsManager . IsCachingEnabledGlobally ,
219+ Duration = Duration ,
220+ VaryByCustom = VaryByCustom ,
221+ VaryByParam = VaryByParam ,
222+ Location = ( int ) Location == - 1 ? OutputCacheLocation . Server : Location ,
223+ NoStore = NoStore ,
224+ Options = Options ,
239225 } ;
240226 }
241227 else
@@ -244,14 +230,13 @@ protected CacheSettings BuildCacheSettings()
244230
245231 cacheSettings = new CacheSettings
246232 {
247- IsCachingEnabled = _cacheSettingsManager . IsCachingEnabledGlobally && cacheProfile . Enabled ,
248- Duration = Duration == - 1 ? cacheProfile . Duration : Duration ,
249- VaryByCustom = VaryByCustom ?? cacheProfile . VaryByCustom ,
250- VaryByParam = VaryByParam ?? cacheProfile . VaryByParam ,
251- Location = ( int ) Location == - 1 ? ( ( int ) cacheProfile . Location == - 1 ? OutputCacheLocation . Server : cacheProfile . Location ) : Location ,
252- NoStore = _noStore . HasValue ? _noStore . Value : cacheProfile . NoStore ,
253- IgnorePostData = IgnorePostData ,
254- IgnoreQueryStringData = IgnoreQueryStringData ,
233+ IsCachingEnabled = _cacheSettingsManager . IsCachingEnabledGlobally && cacheProfile . Enabled ,
234+ Duration = Duration == - 1 ? cacheProfile . Duration : Duration ,
235+ VaryByCustom = VaryByCustom ?? cacheProfile . VaryByCustom ,
236+ VaryByParam = VaryByParam ?? cacheProfile . VaryByParam ,
237+ Location = ( int ) Location == - 1 ? ( ( int ) cacheProfile . Location == - 1 ? OutputCacheLocation . Server : cacheProfile . Location ) : Location ,
238+ NoStore = _noStore . HasValue ? _noStore . Value : cacheProfile . NoStore ,
239+ Options = Options ,
255240 } ;
256241 }
257242
0 commit comments