huacnlee / rails-settings-cached

Global settings for your Rails application.
Other
1.06k stars 202 forks source link

New configurations does not apply to cache. #155

Closed crazyjin closed 5 years ago

crazyjin commented 5 years ago

Application just use the old values in the cache. It a better idea to clear or update configuration values in cache every time just after rails-settings-cached loads a yml.

huacnlee commented 5 years ago

Use cache_prefix to increment version to clear cache.

class Setting
  cache_prefix { "v1" }
end
acrolink commented 3 years ago

Use cache_prefix to increment version to clear cache.

class Setting
  cache_prefix { "v1" }
end

I am facing the same issue. Happens randomly every couple of days. Do you mean that I should increment the cache prefix on every new launch of the Rails application?

If so, I guess it is better to set the cache_prefix dynamically to a unique and new GUID when the application starts.