Update CachingService.cs for RemoveAll() method#113
Closed
ArnaudB88 wants to merge 2 commits intoalastairtree:masterfrom
Closed
Update CachingService.cs for RemoveAll() method#113ArnaudB88 wants to merge 2 commits intoalastairtree:masterfrom
ArnaudB88 wants to merge 2 commits intoalastairtree:masterfrom
Conversation
Add RemoveAll() method which creates a new cacheprovider
jnyrup
reviewed
Mar 31, 2020
| public virtual void RemoveAll() | ||
| { | ||
| CacheProvider.Dispose(); | ||
| cacheProvider = new Lazy<ICacheProvider>(() => |
Contributor
There was a problem hiding this comment.
Initializing a new cacheProvider instead of removing the keys from the existing cacheProvider gives inconsistent behavior to how Remove(key) works.
E.g. if the CachingService was instantiated using any of the constructors except CachingService(), then calling RemoveAll will change the underlying cacheProvider to a DefaultCacheProvider.
Author
There was a problem hiding this comment.
Owner
There was a problem hiding this comment.
Yeah this sort of change will need to incorporate DI so will close in favour of #91
Owner
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add RemoveAll() method which creates a new cacheprovider
See #67