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

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

Backend Configuration collapse

Instance Method Details

#clear_cacheObject


127
128
129
# File 'lib/mobility/backends/key_value.rb', line 127

def clear_cache
  @cache = {}
end

#translation_for(locale, **options) ⇒ Object


118
119
120
121
122
123
124
125
# File 'lib/mobility/backends/key_value.rb', line 118

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