Sha256: 4ba22f49eec7b77d62507a3be268cc6f4a56825f44a9205eea981cf82c9b03e9
Contents?: true
Size: 626 Bytes
Versions: 1
Compression:
Stored size: 626 Bytes
Contents
module RailsSettings class CachedSettings < Settings def rewrite_cache Rails.cache.write("rails_settings_cached:#{var}", value) end def expire_cache Rails.cache.delete("rails_settings_cached:#{var}") end class << self def [](var_name) cache_key = "rails_settings_cached:#{var_name}" obj = Rails.cache.read(cache_key) obj = super(var_name) if obj.nil? return @@defaults[var_name.to_s] if obj.nil? obj end def save_default(key, value) return false unless self[key].nil? self[key] = value end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails-settings-cached-0.4.3 | lib/rails-settings/cached_settings.rb |