Closed c5racing closed 1 year ago
This is resolved. I didn't provide a unique name for the RedisBus Configuration.
```
.WithRedisBus(busConf =>
{
busConf.AllowAdmin = true;
busConf.Endpoints.Add(new ServerEndPoint(redisSettings.Host, redisSettings.Port));
busConf.SerializerName = "newtonSoft";
if (!string.IsNullOrWhiteSpace(redisSettings.Password))
{
busConf.Password = redisSettings.Password;
busConf.IsSsl = true;
}
}, $"bus-{serviceName}")
Description
Is it possible to use multiple hybrid caching providers? I have try adding two; but when resolving IHybridProviderFactory, I get an error resolving this service as there's more than one registered
Related code
Expected behavior: [What you expected to happen]
I can resolve the service and get the provider.
Actual behavior: [What actually happened]
When trying to get IHybridProviderFactory, I get "InvalidOperationException: Sequence contains more than one matching element"
Autofac.Core.DependencyResolutionException: 'An exception was thrown while activating EasyCaching.Core.DefaultHybridProviderFactory -> λ:EasyCaching.Core.IHybridCachingProvider[] -> λ:EasyCaching.Core.IHybridCachingProvider -> λ:EasyCaching.Core.Bus.IEasyCachingBus.'
var hybridFactory = serviceProvider.GetRequiredService<IHybridProviderFactory>(); hybridFactory..GetHybridCachingProvider("hybrid-global");