Module: MultiJson::OptionsCache

Extended by:
OptionsCache
Included in:
OptionsCache
Defined in:
lib/multi_json/options_cache.rb

Instance Method Summary collapse

Instance Method Details

#fetch(type, key, &block) ⇒ Object



10
11
12
13
# File 'lib/multi_json/options_cache.rb', line 10

def fetch(type, key, &block)
  cache = instance_variable_get("@#{type}_cache")
  cache.key?(key) ? cache[key] : write(cache, key, &block)
end

#resetObject



5
6
7
8
# File 'lib/multi_json/options_cache.rb', line 5

def reset
  @dump_cache = {}
  @load_cache = {}
end