Module: Curate::Indexer::StorageModule Private
- Defined in:
- lib/curate/indexer/storage_module.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
A module mixin to expose rudimentary read/write capabilities
Instance Method Summary collapse
- #clear_cache! ⇒ Object private
- #find(pid) ⇒ Object private
- #find_each ⇒ Object private
- #write(doc) ⇒ Object private
Instance Method Details
#clear_cache! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/curate/indexer/storage_module.rb', line 24 def clear_cache! @cache = {} end |
#find(pid) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/curate/indexer/storage_module.rb', line 16 def find(pid) cache.fetch(pid.to_s) end |
#find_each ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/curate/indexer/storage_module.rb', line 20 def find_each cache.each { |_key, document| yield(document) } end |
#write(doc) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 |
# File 'lib/curate/indexer/storage_module.rb', line 12 def write(doc) cache[doc.pid] = doc end |