Skip to content
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

Merged
merged 5 commits into from
Sep 13, 2024
Merged

Conversation

hishamco
Copy link
Member

No description provided.

@hishamco hishamco requested a review from gvkries September 13, 2024 12:41
@hishamco hishamco enabled auto-merge (squash) September 13, 2024 13:05
@hishamco hishamco merged commit e695859 into main Sep 13, 2024
6 checks passed
@hishamco hishamco deleted the hishamco/RedisCacheWrapper branch September 13, 2024 13:17
@sebastienros
Copy link
Member

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.

@hishamco
Copy link
Member Author

@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 ShellHost is disposed which is make sense to me

@sebastienros
Copy link
Member

I don't think there's wrong with disposing of the cache once the Wrapper is disposed

I literally explained why it's wrong in the comment I made

@hishamco
Copy link
Member Author

hishamco commented Sep 13, 2024

I will revert the commit, but at least we should mark this class as sealed, right?

@sebastienros
Copy link
Member

I will revert the commit, but at least we should mark this class as sealed, right?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants