module Mobility::Plugins::Cache::BackendMethods
Public Instance Methods
clear_cache()
click to toggle source
@!endgroup
# File lib/mobility/plugins/cache.rb, line 82 def clear_cache @cache = {} end
read(locale, **options)
click to toggle source
@group Backend
Accessors
@!macro backend_reader @!method read(locale, value, options = {})
@option options [Boolean] cache *false* to disable cache.
Calls superclass method
# File lib/mobility/plugins/cache.rb, line 64 def read(locale, **options) return super(locale, **options) if options.delete(:cache) == false if cache.has_key?(locale) cache[locale] else cache[locale] = super(locale, **options) end end
write(locale, value, **options)
click to toggle source
@!macro backend_writer @option options [Boolean] cache
*false* to disable cache.
Calls superclass method
# File lib/mobility/plugins/cache.rb, line 76 def write(locale, value, **options) return super if options.delete(:cache) == false cache[locale] = super end
Private Instance Methods
cache()
click to toggle source
# File lib/mobility/plugins/cache.rb, line 88 def cache @cache ||= {} end