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

Cache is read twice for a single value #255

Closed
RavWar opened this issue Oct 18, 2024 · 0 comments
Closed

Cache is read twice for a single value #255

RavWar opened this issue Oct 18, 2024 · 0 comments

Comments

@RavWar
Copy link

RavWar commented Oct 18, 2024

Hi! I've noticed a slight performance issue using this gem and found out that by using standard Setting.app_name getters cache is hit twice and it takes twice as long to get the value. By using RailsSettings.config.cache_storage.fetch('rails-settings-cached')['app_name'] cache is hit once and the value returns twice as fast. This can be fixed by memoizing the return value of saved_value method here: https://github.com/huacnlee/rails-settings-cached/blob/main/lib/rails-settings/fields/base.rb#L36

Or is there a reason for this behavior? Thank you for your work, gem is great!

qichunren added a commit to qichunren/rails-settings-cached that referenced this issue Dec 9, 2024
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