-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Implement IDisposable in RedisCacheWrapper #16713
Conversation
src/OrchardCore.Modules/OrchardCore.Redis/Services/RedisCacheWrapper.cs
Outdated
Show resolved
Hide resolved
I think it's important to explain the intent of such changes, at least sharing what the scopes of the service is and why this change is better. So I dug a little... The wrapper is a singleton, at first I didn't see why calling Dispose is better in any way. Being a singleton everything will be release once the application stops. However I looked into the history of this "Wrapper". And it seems that it was added to prevent the internal redis cache service to be "DIsposed" when a tenant is restarted, or the IConnectionMultiplexer that is shared across tenants would be disposed too. Hence the goal of this wrapper is to NOT dispose the redis cache. Please revert it an add a comment on this class explain what its purpose is and why the redis cache should not be disposed. IF there were other goals behind this change please explain them. |
@sebastienros yes the intention is not to dispose of the cache because it's shared across tenants, I don't think there's wrong with disposing of the cache once the Wrapper is disposed For instance, we disposed of the list of shells once the |
I literally explained why it's wrong in the comment I made |
I will revert the commit, but at least we should mark this class as |
Yes this is fine, in your someone will also add the comments on the class to explain why it should not dispose the redis cache. |
No description provided.