Class: JSI::Util::Private::MemoMap::Immutable Private
- Inherits:
-
JSI::Util::Private::MemoMap
- Object
- JSI::Util::Private::MemoMap
- JSI::Util::Private::MemoMap::Immutable
- Defined in:
- lib/jsi/util/private/memo_map.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #[](**inputs) ⇒ Object private
Methods inherited from JSI::Util::Private::MemoMap
Constructor Details
This class inherits a constructor from JSI::Util::Private::MemoMap
Instance Method Details
#[](**inputs) ⇒ 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.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/jsi/util/private/memo_map.rb', line 58 def [](**inputs) key = key_for(inputs) result_mutex = @result_mutexes_mutex.synchronize do @result_mutexes[key] ||= Mutex.new end result_mutex.synchronize do if @results.key?(key) @results[key] else @results[key] = @block.call(**inputs) end end end |