Class: Hdo::StortingImporter::InMemoryCache
- Inherits:
-
Object
- Object
- Hdo::StortingImporter::InMemoryCache
- Defined in:
- lib/hdo/storting_importer/in_memory_cache.rb
Instance Method Summary collapse
- #fetch(key, &blk) ⇒ Object
-
#initialize ⇒ InMemoryCache
constructor
A new instance of InMemoryCache.
Constructor Details
#initialize ⇒ InMemoryCache
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 |