Module: Mobility::Backends::KeyValue::Cache

Defined in:
lib/mobility/backends/key_value.rb

Backend Configuration collapse

Instance Method Details

#clear_cacheObject



132
133
134
# File 'lib/mobility/backends/key_value.rb', line 132

def clear_cache
  @cache = {}
end

#translation_for(locale, **options) ⇒ Object



123
124
125
126
127
128
129
130
# File 'lib/mobility/backends/key_value.rb', line 123

def translation_for(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