Closed melihaydogd closed 2 years ago
I would like to ask why we would prefer to add a ResetCache method rather than the two alternatives below;
Yeah, I agree with @AtakanColak. If the idea is to favor updated versions of the schema — then disabling caching makes more sense. Enabling caching must always be a conscious trade-off between performance and consistency.
Answer for Atakan:
Yes, caching has always a trade-off and the solution I came up with is a very simple solution. However, I think there should be some expire or purge mechanism in a cache to be able to refresh it as in this repository. If I publish 10000 data per second and I only update the schema one a day, disabling cache altogether would reduce the performance unnecessarily.
Thank you for your comments.
@melihaydogd I disagree with closing this PR, especially your point in 2 is highly in favour of this change. However I wanted to double check our requirement by discussing alternatives.
@riferrei I'll merge this if you won't object
Nothing to object. LGTM 👍🏻
After caching, the schema in the cache does not change. If the latest schema changes on the schema registry, the new schema will not be retrieved. This reset mechanism allows retrieving the most updated version of the schema without the need to exit from application.
The cache could be reset periodically to retrieve the most updated version.