-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache stack builder delegate which provides IServiceProvider #207
Comments
Hey @ErikPilsits-RJW - thanks for raising this issue!
Yeah, that's an oversight on my part. I'll likely add a variation of the builder that injects the service provider in so you can resolve your types directly. The reason it doesn't now is that the cache layers and extensions are built before registering the
Interesting. Cache Tower was definitely built with the idea that not everyone needs to provide a context (though it is a must if you want background refreshing to work reliably due to object lifetimes etc). With having multiple cache stacks, yeah, that is a bit of a problem. I'm glad you've got a solution that works for you at the moment though I get it isn't ideal. One though I had was maybe approaching it the same way you can have What's your thoughts on that? |
I'm also not 100% on the it being called |
I would have been comfortable using My initial thought for supporting multiple stacks was something akin to The background refreshes are an interesting situation (having re-read it now). Thinking on my usage I believe I'm ok without using the context (project has been running for almost 2 years without it). I don't refresh directly from any disposables that might be disposed externally, it's all api based data fetches. |
Hey @ErikPilsits-RJW - I'd love for you to have a look at #208 to see whether that would cover your situation well. It adds support for named (I chose the suffix "Accessor" as while it does "create" like a factory, it doesn't create every call as the cache stacks themselves are singleton - I may still change this before merging - if you have any thoughts with this, would love to hear it) |
On first look it's exactly what I need. I guess it's actually more like One thought though. Your current implementation creates new provider, lookup, and accessor singletons for every type of |
This is fixed via #208 with both new overloads for |
My current scenario is that I have a class which provides my Redis connection, and which I register as a singleton in DI. I share this connection with other services in my project via DI. The new fluent cache stack builder doesn't provide me a way to resolve my connection provider when building the cache stack.
I also don't need the context in my cache stacks, but I do need to register multiple cache stacks. So below, I've subclassed
CacheStack
to register within DI.I'm having to do something like this currently.
The text was updated successfully, but these errors were encountered: