Class: Isomorfeus::ThreadLocalComponentCache
- Defined in:
- lib/isomorfeus/react/thread_local_component_cache.rb
Instance Method Summary collapse
- #fetch(key) ⇒ Object
-
#initialize ⇒ ThreadLocalComponentCache
constructor
A new instance of ThreadLocalComponentCache.
- #store(key, rendered_tree, response_status, styles) ⇒ Object
Constructor Details
#initialize ⇒ ThreadLocalComponentCache
Returns a new instance of ThreadLocalComponentCache.
3 4 5 |
# File 'lib/isomorfeus/react/thread_local_component_cache.rb', line 3 def initialize Thread.current[:local_cache] = {} unless Thread.current.key?(:local_cache) end |
Instance Method Details
#fetch(key) ⇒ Object
7 8 9 |
# File 'lib/isomorfeus/react/thread_local_component_cache.rb', line 7 def fetch(key) Thread.current[:local_cache][key] end |
#store(key, rendered_tree, response_status, styles) ⇒ Object
11 12 13 |
# File 'lib/isomorfeus/react/thread_local_component_cache.rb', line 11 def store(key, rendered_tree, response_status, styles) Thread.current[:local_cache][key] = [rendered_tree, response_status, styles] end |