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

Does the cache get invalidated across the multi threads? #148

Open
letrungkien opened this issue Jun 4, 2024 · 2 comments
Open

Does the cache get invalidated across the multi threads? #148

letrungkien opened this issue Jun 4, 2024 · 2 comments

Comments

@letrungkien
Copy link

I like the idea of this gem and would like to know if the translation cache is invalidated across the multi threads?

For example: Translation for key hello is world

  • Web worker A and B are holding the cache as { en: { hello: 'world' } }
  • A translation update request is sent to Web worker A and updated translation for hello to be zworld, I18n.backend.reload! is called and Worker A will refetch the translations and now has the cache as { en: { hello: 'zworld' } }

Does calling I18n.backend.reload! in Worker A also invalidate caches in Worker B?

@timfjord
Copy link
Collaborator

timfjord commented Jun 4, 2024

I don't think that the caching functionality was implemented with the multi-thread support in mind as it keeps the cache in a class variable under the hood.

@letrungkien
Copy link
Author

Thanks. I guess it's a topic for another day.

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

No branches or pull requests

2 participants