Open migr1 opened 5 years ago
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. Any estimation to when its going to be merged?
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. More specific in:
How should it be changed? There are 2 options: Option A: work with a cacheProvider factory function
container => new MemoryCacheProvider(() => new MemoryCache(container.Resolve<IOptions<MemoryCacheOptions>>()))
Option B: make IMemoryCache registration with TransientLTM
Both options have the same result. Personally I prefer option A, so no other code can request an instance of IMemoryCache.
@ArnaudB88 Does the new injection code look ok?
@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. But option A looks good to me :)
@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. It just adds a change of passing a MemoryCache function instead of an instance.
@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
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 https://github.com/alastairtree/LazyCache/issues/67#issuecomment-696413932
Fixes #67 Implemented by internally creating a new IMemoryCache instance.