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

Configurable cache storage feature #234

Closed
viralpraxis opened this issue May 3, 2023 · 3 comments · Fixed by #242
Closed

Configurable cache storage feature #234

viralpraxis opened this issue May 3, 2023 · 3 comments · Fixed by #242

Comments

@viralpraxis
Copy link
Contributor

viralpraxis commented May 3, 2023

There are some cases when one doesn't want to use Rails.cache to store settings cache, i.e. consider multiple rails nodes each using its own memcached server (so each node has Rails.cache pointed to its own memcached node) -- for simplicity and consistency we'd like to use single shared redis server instance for settings caching.

ATM Rails.cache is hardcoded so there's no way to override the storage.

The solution is to make configurable option that can be set to any instance of ActiveSupport::Cache::Store (with default value of Rails.cache)

Are there any reasons this should not be implemented? If not, I'd be happy to provide a PR

@huacnlee
Copy link
Owner

huacnlee commented Oct 16, 2023

Actually, you may not need to care about this.

The cache is a cache, the cache of the RailsSetitngs like any other caches, we don't need to it for special. There is no reason need to do special.

So why do you want storage RailsSettings's cache in a special place? Why not keep them in your Memcached (default Rails cache)?

@huacnlee
Copy link
Owner

huacnlee commented Oct 16, 2023

There are some cases when one doesn't want to use Rails.cache to store settings cache, i.e. consider multiple rails nodes each using its own memcached server (so each node has Rails.cache pointed to its own memcached node) -- for simplicity and consistency we'd like to use single shared redis server instance for settings caching.

By you mentioned, why not let the Rails.cache to a default storage.
Are you still in using the Rails.cache? What this Rails.cache to do, why can not use Rails.cache to storage the RailsSettings's caches?

And how large of your storage items in RailsSettings, is the reason is too big cannot storage that Rails.cache?

@viralpraxis
Copy link
Contributor Author

Let me clarify the issue.

That's a common practice to have a distributed Rails application (i.e. with multiple RoR nodes running the same application) with separated caches (i.e. Rails.cache). For example. you might want to use separate Memcached server for each of these nodes.

In this situation, to ensure some sort of consistency of RailsSetting settings cache among all the nodes you have to use single cache storage (for instance, Redis) that will act as a cache for the nodes. To do so you have to able to configure the gem with that cache storage.

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 a pull request may close this issue.

2 participants