Transparent use of IHybridCachingProvider #575
Unanswered
jodydonetti
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all, kudos for the great library!
I have one question about the use of
IHybridCachingProvider: looking at the docs it seems to me that to use the hybrid approach I need to change my dependencies, fromIEasyCachingProvider/FactorytoIHybridCachingProvider/Factory.One of the biggest advantages of using a caching abstraction is to be able to transparently switch between different implementations.
But, if what I observed above is the case, that would make it impossible to do the transparent switch from 1 level caching to 2 level caching, even though they both implement the same base abstraction (
IEasyCachingProviderBase).I tried using
IEasyCachingProviderFactoryas a dependency, and asking for the hybrid provider via name, but that doesn't work since the hybrid provider is registered in the DI container asIHybridCachingProviderand not asIEasyCachingProvider, and is accessible viaIHybridProviderFactory(instead ofIEasyCachingProviderFactory).I then tried to always use
IHybridCachingProvideras a dependency, and configure it with only 1 level to see if that would do the trick.But it's throwing an exception during instantiation, which I suppose is because of this call which, in turn, throws here.
Am I right?
After trying multiple ways via code and looking at the source, I'm kinda lost therefore this question.
So, in short: is it possible to code against one abstraction and change from 1 level to 2 levels transparently?
And if so, how?
Thanks for your help!
Beta Was this translation helpful? Give feedback.
All reactions