Class: Hdo::StortingImporter::InMemoryCache

Inherits:
Object
  • Object
show all
Defined in:
lib/hdo/storting_importer/in_memory_cache.rb

Instance Method Summary collapse

Constructor Details

#initializeInMemoryCache

Returns a new instance of InMemoryCache.



4
5
6
# File 'lib/hdo/storting_importer/in_memory_cache.rb', line 4

def initialize
  @cache = {}
end

Instance Method Details

#fetch(key, &blk) ⇒ Object



8
9
10
# File 'lib/hdo/storting_importer/in_memory_cache.rb', line 8

def fetch(key, &blk)
  @cache[key] ||= yield
end