public static IProviderOptionsWithDecorator <IEasyCachingProvider> DecorateWithCircuitBreaker(
     this IProviderOptionsWithDecorator <IEasyCachingProvider> options,
     ICircuitBreakerParameters initParameters,
     ICircuitBreakerParameters executeParameters,
     Func <Exception, bool> exceptionFilter)
 {
     return(options.Decorate((name, serviceProvider, cachingProviderFactory) =>
                             () => new DecoratedEasyCachingProvider(
                                 name,
                                 cachingProviderFactory.WithCircuitBreaker(initParameters, executeParameters, exceptionFilter))
                             ));
 }
Ejemplo n.º 2
0
 public static IProviderOptionsWithDecorator <IEasyCachingProvider> DecorateWithFallback(
     this IProviderOptionsWithDecorator <IEasyCachingProvider> options,
     Func <string, IServiceProvider, IEasyCachingProvider> fallbackCachingProviderFactory,
     Func <Exception, bool> exceptionFilter)
 {
     return(options.Decorate((name, serviceProvider, cachingProviderFactory) =>
                             () => new DecoratedEasyCachingProvider(
                                 name,
                                 cachingProviderFactory.WithFallback(
                                     fallbackCachingProviderFactory(name, serviceProvider),
                                     exceptionFilter))
                             ));
 }