lib/rails-settings/base.rb in rails-settings-cached-2.9.3 vs lib/rails-settings/base.rb in rails-settings-cached-2.9.4
- old
+ new
@@ -31,11 +31,11 @@
end
class << self
def clear_cache
RequestCache.reset
- Rails.cache.delete(cache_key)
+ cache_storage.delete(cache_key)
end
def field(key, **opts)
_define_field(key, **opts)
end
@@ -125,15 +125,19 @@
def rails_initialized?
Rails.application&.initialized?
end
def _all_settings
- RequestCache.all_settings ||= Rails.cache.fetch(cache_key, expires_in: 1.week) do
+ RequestCache.all_settings ||= cache_storage.fetch(cache_key, expires_in: 1.week) do
vars = unscoped.select("var, value")
result = {}
vars.each { |record| result[record.var] = record.value }
result.with_indifferent_access
end
+ end
+
+ def cache_storage
+ RailsSettings.config.cache_storage
end
end
end
end