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

Refactor backend cache #58

Merged
merged 5 commits into from
Jul 26, 2017
Merged

Refactor backend cache #58

merged 5 commits into from
Jul 26, 2017

Conversation

shioyama
Copy link
Owner

@shioyama shioyama commented Jul 23, 2017

The current code is unnecessarily complicated. This PR simplifies things so that backends can include a custom module through an apply_module hook. This allows KeyValue and Table backends to modify the Cache module they use just slightly to achieve the same result.

A module builder called TranslationCacher is shared by all cacheing strategies to cache reads; the only difference is which method is cached: in the default Cache module, read is cached; in KeyValue and Table backends, translation_for is cached (so that the translation record itself is cached, rather than the translation value).

@shioyama shioyama force-pushed the refactor_cache branch 4 times, most recently from 1143108 to 83cf416 Compare July 24, 2017 13:35
This commit restructures the current cache to allow the backend to
customize the included module, simplifying greatly the code.
@shioyama shioyama merged commit 391112b into master Jul 26, 2017
@shioyama shioyama deleted the refactor_cache branch July 26, 2017 13:44
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.

1 participant