-
Notifications
You must be signed in to change notification settings - Fork 159
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
Added a RemoveAll function to clear the entire cache #91
base: master
Are you sure you want to change the base?
Conversation
This would be great. To have the ability to 'nuke' the entire cache with a simple _cache.RemoveAll() would be very valuable. |
When will we merge this PR? I need this in our project. Thanks. |
This is much needed in our project also. Thanks. |
+1 |
Could you please merge this feature ? |
+1 |
Does not work correctly in my project (working with dependency injection) |
The dependency injection code should also be changed.
How should it be changed? There are 2 options:
Option B: make IMemoryCache registration with TransientLTM
Both options have the same result. |
…ed with the old cache is released
@ArnaudB88 Does the new injection code look ok? |
Looks fine to me. But it's good to let it review by someone else than me. I have experience in other DI containers than Ninject and MS.DI. |
@alastairtree Is there anything preventing this from going forward? |
I am still thinking about if, and how, LazyCache should support a delete everything feature. In the meantime I have added 2 ways of achieving the same thing without changes to LazyCache to the docs. |
@alastairtree Would it be possible for you to publish an update or some high level overview of what your plans are for this project? It'd be cool to see what you think it should do, what it's doing right, what it can do better, etc? This would help me (and others) identify issues and places to come in with PRs Good to know there are alternatives for emptying the cache as well |
@alastairtree This pull request is basically your first method to empty the entire cache. In my opinion, a clean and more easy to understand way than method 2. |
Very fair - my ability to maintain this project, like all open source is time limited. Key requirements for all changes are that LazyCache should be small, fast and as easy to use as possible, and it should remain current with the latests dot net. In this respect the majority of functionality is done but as you know there are always improvements that can be made. I have done a bunch of housework on the issue list so it is now more manageable and current, and marked many of them as help wanted where PRs would be appreciated so please take a look. |
I have added a long comment detailing some of the challenges with this feature on the issue below which should help explain why it's not yet merged #67 (comment) |
Fixes #67
Implemented by internally creating a new IMemoryCache instance.