-
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
Cannot dispose of cache #179
Comments
Hello, For someone to help debug your problem you would need to provide some example of the code not working. A minimnal reproduction in a console app would make it much easier for others to be able to help. You may also find Stack Overflow is a better source of help for this type of issue as it will get many more eyeballs than raising tickets here. In the mean time I suggest you check out the docs on deleting items from the cache and on emptying the entire cache. Thanks |
I have a similar issue when I register LazyCache in dependency injection. If I dispose the cache with this instruction emptying the entire cache, I get ObjectDisposedException: Cannot access a disposed object. Object name: 'Microsoft.Extensions.Caching.Memory.MemoryCache' when I visit pages that uses the cache. |
I was able to reproduce this in a test.
I think this issue is particularly seen when using DI, and seems to be caused by how objects are being disposed.
I do wonder if This might however be a breaking change and impact on users who're clearing cache by disposing caching provider directly, or have their own implementation of the |
Describe the bug
I have tried everything to get rid of cache including renaming item, providing a new memorycacheprovider etc.. GetorAdd still pulls my old cache no matter what I do even after disposing of provider and creating new provider. How is this possible.
To Reproduce
just try to get new cache under any circumstance
Expected behavior
A clear and concise description of what you expected to happen.
** Framework and Platform
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: