@@ -68,7 +68,6 @@ public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, ITt
6868 if ( ttlStrategy == null ) throw new ArgumentNullException ( nameof ( ttlStrategy ) ) ;
6969 if ( cacheKeyStrategy == null ) throw new ArgumentNullException ( nameof ( cacheKeyStrategy ) ) ;
7070
71- onCacheError ??= ( _ , _ , _ ) => { } ;
7271 Action < Context , string > emptyDelegate = ( _ , _ ) => { } ;
7372
7473 return new AsyncCachePolicy ( cacheProvider , ttlStrategy , cacheKeyStrategy . GetCacheKey , emptyDelegate , emptyDelegate , emptyDelegate , onCacheError , onCacheError ) ;
@@ -110,7 +109,6 @@ public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, ITt
110109 if ( ttlStrategy == null ) throw new ArgumentNullException ( nameof ( ttlStrategy ) ) ;
111110 if ( cacheKeyStrategy == null ) throw new ArgumentNullException ( nameof ( cacheKeyStrategy ) ) ;
112111
113- onCacheError ??= ( _ , _ , _ ) => { } ;
114112 Action < Context , string > emptyDelegate = ( _ , _ ) => { } ;
115113
116114 return new AsyncCachePolicy ( cacheProvider , ttlStrategy , cacheKeyStrategy , emptyDelegate , emptyDelegate , emptyDelegate , onCacheError , onCacheError ) ;
@@ -134,16 +132,14 @@ public static AsyncCachePolicy CacheAsync(IAsyncCacheProvider cacheProvider, ITt
134132 /// <exception cref="ArgumentNullException">onCacheGet</exception>
135133 /// <exception cref="ArgumentNullException">onCacheMiss</exception>
136134 /// <exception cref="ArgumentNullException">onCachePut</exception>
137- /// <exception cref="ArgumentNullException">onCacheGetError</exception>
138- /// <exception cref="ArgumentNullException">onCachePutError</exception>
139135 public static AsyncCachePolicy CacheAsync (
140136 IAsyncCacheProvider cacheProvider ,
141137 TimeSpan ttl ,
142138 Action < Context , string > onCacheGet ,
143139 Action < Context , string > onCacheMiss ,
144140 Action < Context , string > onCachePut ,
145- Action < Context , string , Exception > onCacheGetError ,
146- Action < Context , string , Exception > onCachePutError ) =>
141+ Action < Context , string , Exception > ? onCacheGetError ,
142+ Action < Context , string , Exception > ? onCachePutError ) =>
147143 CacheAsync ( cacheProvider , new RelativeTtl ( ttl ) , DefaultCacheKeyStrategy . Instance . GetCacheKey , onCacheGet , onCacheMiss , onCachePut , onCacheGetError , onCachePutError ) ;
148144
149145 /// <summary>
@@ -165,16 +161,14 @@ public static AsyncCachePolicy CacheAsync(
165161 /// <exception cref="ArgumentNullException">onCacheGet</exception>
166162 /// <exception cref="ArgumentNullException">onCacheMiss</exception>
167163 /// <exception cref="ArgumentNullException">onCachePut</exception>
168- /// <exception cref="ArgumentNullException">onCacheGetError</exception>
169- /// <exception cref="ArgumentNullException">onCachePutError</exception>
170164 public static AsyncCachePolicy CacheAsync (
171165 IAsyncCacheProvider cacheProvider ,
172166 ITtlStrategy ttlStrategy ,
173167 Action < Context , string > onCacheGet ,
174168 Action < Context , string > onCacheMiss ,
175169 Action < Context , string > onCachePut ,
176- Action < Context , string , Exception > onCacheGetError ,
177- Action < Context , string , Exception > onCachePutError ) =>
170+ Action < Context , string , Exception > ? onCacheGetError ,
171+ Action < Context , string , Exception > ? onCachePutError ) =>
178172 CacheAsync ( cacheProvider , ttlStrategy , DefaultCacheKeyStrategy . Instance . GetCacheKey , onCacheGet , onCacheMiss , onCachePut , onCacheGetError , onCachePutError ) ;
179173
180174 /// <summary>
@@ -197,17 +191,15 @@ public static AsyncCachePolicy CacheAsync(
197191 /// <exception cref="ArgumentNullException">onCacheGet</exception>
198192 /// <exception cref="ArgumentNullException">onCacheMiss</exception>
199193 /// <exception cref="ArgumentNullException">onCachePut</exception>
200- /// <exception cref="ArgumentNullException">onCacheGetError</exception>
201- /// <exception cref="ArgumentNullException">onCachePutError</exception>
202194 public static AsyncCachePolicy CacheAsync (
203195 IAsyncCacheProvider cacheProvider ,
204196 TimeSpan ttl ,
205197 ICacheKeyStrategy cacheKeyStrategy ,
206198 Action < Context , string > onCacheGet ,
207199 Action < Context , string > onCacheMiss ,
208200 Action < Context , string > onCachePut ,
209- Action < Context , string , Exception > onCacheGetError ,
210- Action < Context , string , Exception > onCachePutError ) =>
201+ Action < Context , string , Exception > ? onCacheGetError ,
202+ Action < Context , string , Exception > ? onCachePutError ) =>
211203 CacheAsync ( cacheProvider , new RelativeTtl ( ttl ) , cacheKeyStrategy . GetCacheKey , onCacheGet , onCacheMiss , onCachePut , onCacheGetError , onCachePutError ) ;
212204
213205 /// <summary>
@@ -231,17 +223,15 @@ public static AsyncCachePolicy CacheAsync(
231223 /// <exception cref="ArgumentNullException">onCacheGet</exception>
232224 /// <exception cref="ArgumentNullException">onCacheMiss</exception>
233225 /// <exception cref="ArgumentNullException">onCachePut</exception>
234- /// <exception cref="ArgumentNullException">onCacheGetError</exception>
235- /// <exception cref="ArgumentNullException">onCachePutError</exception>
236226 public static AsyncCachePolicy CacheAsync (
237227 IAsyncCacheProvider cacheProvider ,
238228 ITtlStrategy ttlStrategy ,
239229 ICacheKeyStrategy cacheKeyStrategy ,
240230 Action < Context , string > onCacheGet ,
241231 Action < Context , string > onCacheMiss ,
242232 Action < Context , string > onCachePut ,
243- Action < Context , string , Exception > onCacheGetError ,
244- Action < Context , string , Exception > onCachePutError ) =>
233+ Action < Context , string , Exception > ? onCacheGetError ,
234+ Action < Context , string , Exception > ? onCachePutError ) =>
245235 CacheAsync ( cacheProvider , ttlStrategy , cacheKeyStrategy . GetCacheKey , onCacheGet , onCacheMiss , onCachePut , onCacheGetError , onCachePutError ) ;
246236
247237 /// <summary>
@@ -264,17 +254,15 @@ public static AsyncCachePolicy CacheAsync(
264254 /// <exception cref="ArgumentNullException">onCacheGet</exception>
265255 /// <exception cref="ArgumentNullException">onCacheMiss</exception>
266256 /// <exception cref="ArgumentNullException">onCachePut</exception>
267- /// <exception cref="ArgumentNullException">onCacheGetError</exception>
268- /// <exception cref="ArgumentNullException">onCachePutError</exception>
269257 public static AsyncCachePolicy CacheAsync (
270258 IAsyncCacheProvider cacheProvider ,
271259 TimeSpan ttl ,
272260 Func < Context , string > cacheKeyStrategy ,
273261 Action < Context , string > onCacheGet ,
274262 Action < Context , string > onCacheMiss ,
275263 Action < Context , string > onCachePut ,
276- Action < Context , string , Exception > onCacheGetError ,
277- Action < Context , string , Exception > onCachePutError ) =>
264+ Action < Context , string , Exception > ? onCacheGetError ,
265+ Action < Context , string , Exception > ? onCachePutError ) =>
278266 CacheAsync ( cacheProvider , new RelativeTtl ( ttl ) , cacheKeyStrategy , onCacheGet , onCacheMiss , onCachePut , onCacheGetError , onCachePutError ) ;
279267
280268 /// <summary>
@@ -298,17 +286,15 @@ public static AsyncCachePolicy CacheAsync(
298286 /// <exception cref="ArgumentNullException">onCacheGet</exception>
299287 /// <exception cref="ArgumentNullException">onCacheMiss</exception>
300288 /// <exception cref="ArgumentNullException">onCachePut</exception>
301- /// <exception cref="ArgumentNullException">onCacheGetError</exception>
302- /// <exception cref="ArgumentNullException">onCachePutError</exception>
303289 public static AsyncCachePolicy CacheAsync (
304290 IAsyncCacheProvider cacheProvider ,
305291 ITtlStrategy ttlStrategy ,
306292 Func < Context , string > cacheKeyStrategy ,
307293 Action < Context , string > onCacheGet ,
308294 Action < Context , string > onCacheMiss ,
309295 Action < Context , string > onCachePut ,
310- Action < Context , string , Exception > onCacheGetError ,
311- Action < Context , string , Exception > onCachePutError )
296+ Action < Context , string , Exception > ? onCacheGetError ,
297+ Action < Context , string , Exception > ? onCachePutError )
312298 {
313299 if ( cacheProvider == null ) throw new ArgumentNullException ( nameof ( cacheProvider ) ) ;
314300 if ( ttlStrategy == null ) throw new ArgumentNullException ( nameof ( ttlStrategy ) ) ;
@@ -317,8 +303,6 @@ public static AsyncCachePolicy CacheAsync(
317303 if ( onCacheGet == null ) throw new ArgumentNullException ( nameof ( onCacheGet ) ) ;
318304 if ( onCacheMiss == null ) throw new ArgumentNullException ( nameof ( onCacheMiss ) ) ;
319305 if ( onCachePut == null ) throw new ArgumentNullException ( nameof ( onCachePut ) ) ;
320- if ( onCacheGetError == null ) throw new ArgumentNullException ( nameof ( onCacheGetError ) ) ;
321- if ( onCachePutError == null ) throw new ArgumentNullException ( nameof ( onCachePutError ) ) ;
322306
323307 return new AsyncCachePolicy ( cacheProvider , ttlStrategy , cacheKeyStrategy , onCacheGet , onCacheMiss , onCachePut , onCacheGetError , onCachePutError ) ;
324308 }
0 commit comments