isomorfeus-react 16.13.11 → 16.13.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/isomorfeus/react/config.rb +189 -189
- data/lib/isomorfeus/react/memcached_component_cache.rb +19 -19
- data/lib/isomorfeus/react/redis_component_cache.rb +19 -19
- data/lib/isomorfeus/react/thread_local_component_cache.rb +15 -15
- data/lib/isomorfeus/react_view_helper.rb +231 -231
- data/lib/isomorfeus/top_level.rb +103 -103
- data/lib/isomorfeus/top_level_ssr.rb +42 -42
- data/lib/isomorfeus-react-material-ui.rb +4 -4
- data/lib/isomorfeus-react-native.rb +5 -5
- data/lib/isomorfeus-react-paper.rb +4 -4
- data/lib/isomorfeus-react.rb +120 -120
- data/lib/isomorfeus_react/lucid_app/api.rb +26 -26
- data/lib/isomorfeus_react/lucid_app/base.rb +7 -7
- data/lib/isomorfeus_react/lucid_app/mixin.rb +23 -23
- data/lib/isomorfeus_react/lucid_app/native_component_constructor.rb +48 -48
- data/lib/isomorfeus_react/lucid_app/native_lucid_component_constructor.rb +94 -95
- data/lib/isomorfeus_react/lucid_component/api.rb +75 -75
- data/lib/isomorfeus_react/lucid_component/app_store_proxy.rb +37 -37
- data/lib/isomorfeus_react/lucid_component/base.rb +7 -7
- data/lib/isomorfeus_react/lucid_component/class_store_proxy.rb +44 -44
- data/lib/isomorfeus_react/lucid_component/initializer.rb +14 -14
- data/lib/isomorfeus_react/lucid_component/instance_store_proxy.rb +44 -44
- data/lib/isomorfeus_react/lucid_component/mixin.rb +22 -22
- data/lib/isomorfeus_react/lucid_component/native_component_constructor.rb +35 -35
- data/lib/isomorfeus_react/lucid_component/native_lucid_component_constructor.rb +82 -83
- data/lib/isomorfeus_react/lucid_component/styles_api.rb +34 -34
- data/lib/isomorfeus_react/lucid_func/base.rb +7 -7
- data/lib/isomorfeus_react/lucid_func/initializer.rb +11 -11
- data/lib/isomorfeus_react/lucid_func/mixin.rb +18 -18
- data/lib/isomorfeus_react/lucid_func/native_component_constructor.rb +81 -81
- data/lib/isomorfeus_react/react/function_component/api.rb +105 -105
- data/lib/isomorfeus_react/react/function_component/base.rb +8 -8
- data/lib/isomorfeus_react/react/function_component/initializer.rb +10 -10
- data/lib/isomorfeus_react/react/function_component/mixin.rb +17 -17
- data/lib/isomorfeus_react/react/function_component/native_component_constructor.rb +48 -48
- data/lib/isomorfeus_react/react/memo_component/base.rb +8 -8
- data/lib/isomorfeus_react/react/memo_component/mixin.rb +17 -17
- data/lib/isomorfeus_react/react/memo_component/native_component_constructor.rb +49 -49
- data/lib/isomorfeus_react_material/lucid_material/app/base.rb +8 -8
- data/lib/isomorfeus_react_material/lucid_material/app/mixin.rb +20 -20
- data/lib/isomorfeus_react_material/lucid_material/app/native_component_constructor.rb +50 -50
- data/lib/isomorfeus_react_material/lucid_material/component/base.rb +9 -9
- data/lib/isomorfeus_react_material/lucid_material/component/mixin.rb +19 -19
- data/lib/isomorfeus_react_material/lucid_material/component/native_component_constructor.rb +36 -36
- data/lib/isomorfeus_react_material/lucid_material/func/base.rb +9 -9
- data/lib/isomorfeus_react_material/lucid_material/func/mixin.rb +15 -15
- data/lib/isomorfeus_react_material/lucid_material/func/native_component_constructor.rb +83 -83
- data/lib/isomorfeus_react_paper/lucid_paper/app/base.rb +9 -9
- data/lib/isomorfeus_react_paper/lucid_paper/app/mixin.rb +19 -19
- data/lib/isomorfeus_react_paper/lucid_paper/app/native_component_constructor.rb +32 -32
- data/lib/isomorfeus_react_paper/lucid_paper/component/base.rb +9 -9
- data/lib/isomorfeus_react_paper/lucid_paper/component/mixin.rb +18 -18
- data/lib/isomorfeus_react_paper/lucid_paper/component/native_component_constructor.rb +25 -25
- data/lib/isomorfeus_react_paper/lucid_paper/func/base.rb +9 -9
- data/lib/isomorfeus_react_paper/lucid_paper/func/mixin.rb +14 -14
- data/lib/isomorfeus_react_paper/lucid_paper/func/native_component_constructor.rb +71 -71
- data/lib/lucid_app/context.rb +7 -7
- data/lib/lucid_prop_declaration/mixin.rb +126 -126
- data/lib/react/children.rb +34 -34
- data/lib/react/component/api.rb +134 -134
- data/lib/react/component/base.rb +8 -8
- data/lib/react/component/callbacks.rb +115 -115
- data/lib/react/component/elements.rb +60 -60
- data/lib/react/component/features.rb +48 -48
- data/lib/react/component/history.rb +69 -65
- data/lib/react/component/initializer.rb +11 -11
- data/lib/react/component/location.rb +19 -15
- data/lib/react/component/match.rb +35 -31
- data/lib/react/component/mixin.rb +20 -20
- data/lib/react/component/native_component_constructor.rb +69 -70
- data/lib/react/component/props.rb +83 -83
- data/lib/react/component/resolution.rb +97 -97
- data/lib/react/component/state.rb +58 -54
- data/lib/react/component/styles.rb +66 -66
- data/lib/react/context_wrapper.rb +48 -44
- data/lib/react/native_constant_wrapper.rb +29 -29
- data/lib/react/ref.rb +16 -12
- data/lib/react/synthetic_event.rb +52 -52
- data/lib/react/version.rb +3 -3
- data/lib/react.rb +296 -296
- data/lib/react_dom.rb +41 -41
- data/lib/react_dom_server.rb +18 -18
- data/lib/react_native/component/elements.rb +203 -203
- data/lib/react_native/lucid_app/react_native_component_constructor.rb +51 -51
- data/lib/react_native/lucid_component/react_native_component_constructor.rb +37 -37
- data/lib/react_native/lucid_func/react_native_component_constructor.rb +82 -82
- data/lib/react_native/react.rb +120 -120
- metadata +23 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8f9816e2fafdce848a3c954dee14a9afbb099af1a9d5969b60745890cb7d68f
|
4
|
+
data.tar.gz: 33711bec7c6eaaac3e03054059fc156cbe0965bb852ec613365ef0e9667d8201
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0378cf74b5a5ad0847b17d390858573fbefffab89d5b24a773236e7d1ff5c06d68b04619851f2404e7b15bd697864b6546119cfd269a36bbb819682e4c7a00a1'
|
7
|
+
data.tar.gz: 39d4e06a48451fe2cc647a97ca9680356531811bbb607b9490d1bef1de4ab0cc2c9a7b0ebdc6d8cbca7a81ece7aaaf11fe005cf79aeb55cbdc34aa3af488c8f0
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# isomorfeus-react
|
2
2
|
|
3
|
+
Isomorfeus-react is obsolete, superseded by [isomorfeus-preact](https://github.com/isomorfeus/isomorfeus-preact)
|
4
|
+
leo.or
|
3
5
|
Develop React components for Opal Ruby along with very easy to use and advanced React-Redux Components.
|
4
6
|
|
5
7
|
## Community and Support
|
@@ -9,7 +11,7 @@ At the [Isomorfeus Framework Project](http://isomorfeus.com)
|
|
9
11
|
isomorfeus-react version follows the React version which features and API it implements.
|
10
12
|
|
11
13
|
### React
|
12
|
-
Isomorfeus-react
|
14
|
+
Isomorfeus-react 17.0.x implements features and the API of React 17.0.x and should be used with React 17.0.x
|
13
15
|
|
14
16
|
## Documentation
|
15
17
|
|
@@ -1,189 +1,189 @@
|
|
1
|
-
module Isomorfeus
|
2
|
-
if RUBY_ENGINE == 'opal'
|
3
|
-
class << self
|
4
|
-
attr_accessor :current_user_sid
|
5
|
-
attr_accessor :initial_state_fetched
|
6
|
-
attr_accessor :top_component
|
7
|
-
attr_accessor :ssr_response_status
|
8
|
-
attr_reader :initialized
|
9
|
-
attr_reader :env
|
10
|
-
attr_accessor :zeitwerk
|
11
|
-
|
12
|
-
def init
|
13
|
-
return if initialized
|
14
|
-
@initialized = true
|
15
|
-
Isomorfeus.init_store
|
16
|
-
execute_init_classes
|
17
|
-
end
|
18
|
-
|
19
|
-
def force_init!
|
20
|
-
unless Isomorfeus.initial_state_fetched
|
21
|
-
Isomorfeus.initial_state_fetched = true
|
22
|
-
Redux::Store.preloaded_state = Isomorfeus.store.get_state
|
23
|
-
end
|
24
|
-
Isomorfeus.force_init_store!
|
25
|
-
execute_init_classes
|
26
|
-
end
|
27
|
-
|
28
|
-
def add_client_init_class_name(init_class_name)
|
29
|
-
client_init_class_names << init_class_name
|
30
|
-
end
|
31
|
-
|
32
|
-
def add_client_init_after_store_class_name(init_class_name)
|
33
|
-
client_init_after_store_class_names << init_class_name
|
34
|
-
end
|
35
|
-
|
36
|
-
def add_client_option(key, value = nil)
|
37
|
-
self.class.attr_accessor(key)
|
38
|
-
self.send("#{key}=", value)
|
39
|
-
end
|
40
|
-
|
41
|
-
# only used for SSR
|
42
|
-
def cached_component_classes
|
43
|
-
@cached_component_classes ||= {}
|
44
|
-
end
|
45
|
-
|
46
|
-
# only used for SSR
|
47
|
-
def cached_component_class(class_name)
|
48
|
-
return cached_component_classes[class_name] if cached_component_classes.key?(class_name)
|
49
|
-
cached_component_classes[class_name] = "::#{class_name}".constantize
|
50
|
-
end
|
51
|
-
|
52
|
-
def execute_init_classes
|
53
|
-
client_init_class_names.each do |constant|
|
54
|
-
constant.constantize.send(:init)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def execute_init_after_store_classes
|
59
|
-
client_init_after_store_class_names.each do |constant|
|
60
|
-
constant.constantize.send(:init)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def env=(env_string)
|
65
|
-
@env = env_string ? env_string : 'development'
|
66
|
-
@development = (@env == 'development') ? true : false
|
67
|
-
@production = (@env == 'production') ? true : false
|
68
|
-
@test = (@env == 'test') ? true : false
|
69
|
-
end
|
70
|
-
|
71
|
-
def development?
|
72
|
-
@development
|
73
|
-
end
|
74
|
-
|
75
|
-
def production?
|
76
|
-
@production
|
77
|
-
end
|
78
|
-
|
79
|
-
def test?
|
80
|
-
@test
|
81
|
-
end
|
82
|
-
|
83
|
-
def start_app!
|
84
|
-
Isomorfeus.zeitwerk.setup
|
85
|
-
Isomorfeus::TopLevel.mount!
|
86
|
-
end
|
87
|
-
|
88
|
-
def force_render
|
89
|
-
begin
|
90
|
-
if Isomorfeus.top_component
|
91
|
-
ReactDOM.find_dom_node(Isomorfeus.top_component) if on_browser? || on_desktop? # if not mounted will raise
|
92
|
-
if `typeof Opal.global.deepForceUpdate === 'undefined'`
|
93
|
-
Isomorfeus.top_component.JS.forceUpdate()
|
94
|
-
else
|
95
|
-
`Opal.global.deepForceUpdate(#{Isomorfeus.top_component})`
|
96
|
-
end
|
97
|
-
end
|
98
|
-
rescue Exception => e
|
99
|
-
# TODO try mount first
|
100
|
-
# if it fails
|
101
|
-
`console.error("force_render failed'! Error: " + #{e.message} + "! Reloading page.")`
|
102
|
-
`location.reload()` if on_browser?
|
103
|
-
end
|
104
|
-
nil
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
self.add_client_option(:client_init_class_names, [])
|
109
|
-
self.add_client_option(:client_init_after_store_class_names, [])
|
110
|
-
else
|
111
|
-
class << self
|
112
|
-
attr_reader :component_cache_init_block
|
113
|
-
attr_accessor :server_side_rendering
|
114
|
-
attr_accessor :ssr_hot_asset_url
|
115
|
-
attr_reader :env
|
116
|
-
attr_accessor :zeitwerk
|
117
|
-
attr_accessor :zeitwerk_lock
|
118
|
-
|
119
|
-
def component_cache_init(&block)
|
120
|
-
@component_cache_init_block = block
|
121
|
-
end
|
122
|
-
|
123
|
-
def configuration(&block)
|
124
|
-
block.call(self)
|
125
|
-
end
|
126
|
-
|
127
|
-
def env=(env_string)
|
128
|
-
@env = env_string ? env_string.to_s : 'development'
|
129
|
-
@development = (@env == 'development') ? true : false
|
130
|
-
@production = (@env == 'production') ? true : false
|
131
|
-
@test = (@env == 'test') ? true : false
|
132
|
-
end
|
133
|
-
|
134
|
-
def development?
|
135
|
-
@development
|
136
|
-
end
|
137
|
-
|
138
|
-
def production?
|
139
|
-
@production
|
140
|
-
end
|
141
|
-
|
142
|
-
def test?
|
143
|
-
@test
|
144
|
-
end
|
145
|
-
|
146
|
-
def ssr_contexts
|
147
|
-
@ssr_contexts ||= {}
|
148
|
-
end
|
149
|
-
|
150
|
-
def version
|
151
|
-
Isomorfeus::VERSION
|
152
|
-
end
|
153
|
-
|
154
|
-
def load_configuration(directory)
|
155
|
-
Dir.glob(File.join(directory, '*.rb')).sort.each do |file|
|
156
|
-
require File.expand_path(file)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
class << self
|
163
|
-
def raise_error(error_class: nil, message: nil, stack: nil)
|
164
|
-
error_class = RuntimeError unless error_class
|
165
|
-
execution_environment = if on_browser? then 'on Browser'
|
166
|
-
elsif on_ssr? then 'in Server Side Rendering'
|
167
|
-
elsif on_server? then 'on Server'
|
168
|
-
elsif on_mobile? then 'on Mobile'
|
169
|
-
elsif on_database? then 'on Database'
|
170
|
-
else
|
171
|
-
'on Client'
|
172
|
-
end
|
173
|
-
error = error_class.new("Isomorfeus in #{env} #{execution_environment}:\n#{message}")
|
174
|
-
error.set_backtrace(stack) if stack
|
175
|
-
|
176
|
-
if Isomorfeus.development?
|
177
|
-
if RUBY_ENGINE == 'opal'
|
178
|
-
ecn = error_class ? error_class.name : ''
|
179
|
-
m = message ? message : ''
|
180
|
-
s = stack ? stack : ''
|
181
|
-
`console.error(ecn, m, s)`
|
182
|
-
else
|
183
|
-
STDERR.puts "#{ecn}: #{m}\n #{s}"
|
184
|
-
end
|
185
|
-
end
|
186
|
-
raise error
|
187
|
-
end
|
188
|
-
end
|
189
|
-
end
|
1
|
+
module Isomorfeus
|
2
|
+
if RUBY_ENGINE == 'opal'
|
3
|
+
class << self
|
4
|
+
attr_accessor :current_user_sid
|
5
|
+
attr_accessor :initial_state_fetched
|
6
|
+
attr_accessor :top_component
|
7
|
+
attr_accessor :ssr_response_status
|
8
|
+
attr_reader :initialized
|
9
|
+
attr_reader :env
|
10
|
+
attr_accessor :zeitwerk
|
11
|
+
|
12
|
+
def init
|
13
|
+
return if initialized
|
14
|
+
@initialized = true
|
15
|
+
Isomorfeus.init_store
|
16
|
+
execute_init_classes
|
17
|
+
end
|
18
|
+
|
19
|
+
def force_init!
|
20
|
+
unless Isomorfeus.initial_state_fetched
|
21
|
+
Isomorfeus.initial_state_fetched = true
|
22
|
+
Redux::Store.preloaded_state = Isomorfeus.store.get_state
|
23
|
+
end
|
24
|
+
Isomorfeus.force_init_store!
|
25
|
+
execute_init_classes
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_client_init_class_name(init_class_name)
|
29
|
+
client_init_class_names << init_class_name
|
30
|
+
end
|
31
|
+
|
32
|
+
def add_client_init_after_store_class_name(init_class_name)
|
33
|
+
client_init_after_store_class_names << init_class_name
|
34
|
+
end
|
35
|
+
|
36
|
+
def add_client_option(key, value = nil)
|
37
|
+
self.class.attr_accessor(key)
|
38
|
+
self.send("#{key}=", value)
|
39
|
+
end
|
40
|
+
|
41
|
+
# only used for SSR
|
42
|
+
def cached_component_classes
|
43
|
+
@cached_component_classes ||= {}
|
44
|
+
end
|
45
|
+
|
46
|
+
# only used for SSR
|
47
|
+
def cached_component_class(class_name)
|
48
|
+
return cached_component_classes[class_name] if cached_component_classes.key?(class_name)
|
49
|
+
cached_component_classes[class_name] = "::#{class_name}".constantize
|
50
|
+
end
|
51
|
+
|
52
|
+
def execute_init_classes
|
53
|
+
client_init_class_names.each do |constant|
|
54
|
+
constant.constantize.send(:init)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def execute_init_after_store_classes
|
59
|
+
client_init_after_store_class_names.each do |constant|
|
60
|
+
constant.constantize.send(:init)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def env=(env_string)
|
65
|
+
@env = env_string ? env_string : 'development'
|
66
|
+
@development = (@env == 'development') ? true : false
|
67
|
+
@production = (@env == 'production') ? true : false
|
68
|
+
@test = (@env == 'test') ? true : false
|
69
|
+
end
|
70
|
+
|
71
|
+
def development?
|
72
|
+
@development
|
73
|
+
end
|
74
|
+
|
75
|
+
def production?
|
76
|
+
@production
|
77
|
+
end
|
78
|
+
|
79
|
+
def test?
|
80
|
+
@test
|
81
|
+
end
|
82
|
+
|
83
|
+
def start_app!
|
84
|
+
Isomorfeus.zeitwerk.setup
|
85
|
+
Isomorfeus::TopLevel.mount!
|
86
|
+
end
|
87
|
+
|
88
|
+
def force_render
|
89
|
+
begin
|
90
|
+
if Isomorfeus.top_component
|
91
|
+
ReactDOM.find_dom_node(Isomorfeus.top_component) if on_browser? || on_desktop? # if not mounted will raise
|
92
|
+
if `typeof Opal.global.deepForceUpdate === 'undefined'`
|
93
|
+
Isomorfeus.top_component.JS.forceUpdate()
|
94
|
+
else
|
95
|
+
`Opal.global.deepForceUpdate(#{Isomorfeus.top_component})`
|
96
|
+
end
|
97
|
+
end
|
98
|
+
rescue Exception => e
|
99
|
+
# TODO try mount first
|
100
|
+
# if it fails
|
101
|
+
`console.error("force_render failed'! Error: " + #{e.message} + "! Reloading page.")`
|
102
|
+
`location.reload()` if on_browser?
|
103
|
+
end
|
104
|
+
nil
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
self.add_client_option(:client_init_class_names, [])
|
109
|
+
self.add_client_option(:client_init_after_store_class_names, [])
|
110
|
+
else
|
111
|
+
class << self
|
112
|
+
attr_reader :component_cache_init_block
|
113
|
+
attr_accessor :server_side_rendering
|
114
|
+
attr_accessor :ssr_hot_asset_url
|
115
|
+
attr_reader :env
|
116
|
+
attr_accessor :zeitwerk
|
117
|
+
attr_accessor :zeitwerk_lock
|
118
|
+
|
119
|
+
def component_cache_init(&block)
|
120
|
+
@component_cache_init_block = block
|
121
|
+
end
|
122
|
+
|
123
|
+
def configuration(&block)
|
124
|
+
block.call(self)
|
125
|
+
end
|
126
|
+
|
127
|
+
def env=(env_string)
|
128
|
+
@env = env_string ? env_string.to_s : 'development'
|
129
|
+
@development = (@env == 'development') ? true : false
|
130
|
+
@production = (@env == 'production') ? true : false
|
131
|
+
@test = (@env == 'test') ? true : false
|
132
|
+
end
|
133
|
+
|
134
|
+
def development?
|
135
|
+
@development
|
136
|
+
end
|
137
|
+
|
138
|
+
def production?
|
139
|
+
@production
|
140
|
+
end
|
141
|
+
|
142
|
+
def test?
|
143
|
+
@test
|
144
|
+
end
|
145
|
+
|
146
|
+
def ssr_contexts
|
147
|
+
@ssr_contexts ||= {}
|
148
|
+
end
|
149
|
+
|
150
|
+
def version
|
151
|
+
Isomorfeus::VERSION
|
152
|
+
end
|
153
|
+
|
154
|
+
def load_configuration(directory)
|
155
|
+
Dir.glob(File.join(directory, '*.rb')).sort.each do |file|
|
156
|
+
require File.expand_path(file)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
class << self
|
163
|
+
def raise_error(error_class: nil, message: nil, stack: nil)
|
164
|
+
error_class = RuntimeError unless error_class
|
165
|
+
execution_environment = if on_browser? then 'on Browser'
|
166
|
+
elsif on_ssr? then 'in Server Side Rendering'
|
167
|
+
elsif on_server? then 'on Server'
|
168
|
+
elsif on_mobile? then 'on Mobile'
|
169
|
+
elsif on_database? then 'on Database'
|
170
|
+
else
|
171
|
+
'on Client'
|
172
|
+
end
|
173
|
+
error = error_class.new("Isomorfeus in #{env} #{execution_environment}:\n#{message}")
|
174
|
+
error.set_backtrace(stack) if stack
|
175
|
+
|
176
|
+
if Isomorfeus.development?
|
177
|
+
if RUBY_ENGINE == 'opal'
|
178
|
+
ecn = error_class ? error_class.name : ''
|
179
|
+
m = message ? message : ''
|
180
|
+
s = stack ? stack : ''
|
181
|
+
`console.error(ecn, m, s)`
|
182
|
+
else
|
183
|
+
STDERR.puts "#{ecn}: #{m}\n #{s}"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
raise error
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
@@ -1,19 +1,19 @@
|
|
1
|
-
module Isomorfeus
|
2
|
-
module Professional
|
3
|
-
class MemcachedComponentCache
|
4
|
-
def initialize(*args)
|
5
|
-
@dalli_client = Dalli::Client.new(*args)
|
6
|
-
end
|
7
|
-
|
8
|
-
def fetch(key)
|
9
|
-
json = @dalli_client.get(key)
|
10
|
-
Oj.load(json, mode: :strict)
|
11
|
-
end
|
12
|
-
|
13
|
-
def store(key, rendered_tree, response_status, styles)
|
14
|
-
json = Oj.dump([rendered_tree, response_status, styles], mode: :strict)
|
15
|
-
@dalli_client.set(key, json)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
1
|
+
module Isomorfeus
|
2
|
+
module Professional
|
3
|
+
class MemcachedComponentCache
|
4
|
+
def initialize(*args)
|
5
|
+
@dalli_client = Dalli::Client.new(*args)
|
6
|
+
end
|
7
|
+
|
8
|
+
def fetch(key)
|
9
|
+
json = @dalli_client.get(key)
|
10
|
+
Oj.load(json, mode: :strict)
|
11
|
+
end
|
12
|
+
|
13
|
+
def store(key, rendered_tree, response_status, styles)
|
14
|
+
json = Oj.dump([rendered_tree, response_status, styles], mode: :strict)
|
15
|
+
@dalli_client.set(key, json)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,19 +1,19 @@
|
|
1
|
-
module Isomorfeus
|
2
|
-
module Professional
|
3
|
-
class RedisComponentCache
|
4
|
-
def initialize(*args)
|
5
|
-
@redis_client = Redis.new(@args)
|
6
|
-
end
|
7
|
-
|
8
|
-
def fetch(key)
|
9
|
-
json = @redis_client.get(key)
|
10
|
-
Oj.load(json, mode: :strict)
|
11
|
-
end
|
12
|
-
|
13
|
-
def store(key, rendered_tree, response_status, styles)
|
14
|
-
json = Oj.dump([rendered_tree, response_status, styles], mode: :strict)
|
15
|
-
@redis_client.set(key, json)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
1
|
+
module Isomorfeus
|
2
|
+
module Professional
|
3
|
+
class RedisComponentCache
|
4
|
+
def initialize(*args)
|
5
|
+
@redis_client = Redis.new(@args)
|
6
|
+
end
|
7
|
+
|
8
|
+
def fetch(key)
|
9
|
+
json = @redis_client.get(key)
|
10
|
+
Oj.load(json, mode: :strict)
|
11
|
+
end
|
12
|
+
|
13
|
+
def store(key, rendered_tree, response_status, styles)
|
14
|
+
json = Oj.dump([rendered_tree, response_status, styles], mode: :strict)
|
15
|
+
@redis_client.set(key, json)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
|
-
module Isomorfeus
|
2
|
-
class ThreadLocalComponentCache
|
3
|
-
def initialize
|
4
|
-
Thread.current[:local_cache] = {} unless Thread.current.key?(:local_cache)
|
5
|
-
end
|
6
|
-
|
7
|
-
def fetch(key)
|
8
|
-
Thread.current[:local_cache][key]
|
9
|
-
end
|
10
|
-
|
11
|
-
def store(key, rendered_tree, response_status, styles)
|
12
|
-
Thread.current[:local_cache][key] = [rendered_tree, response_status, styles]
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
1
|
+
module Isomorfeus
|
2
|
+
class ThreadLocalComponentCache
|
3
|
+
def initialize
|
4
|
+
Thread.current[:local_cache] = {} unless Thread.current.key?(:local_cache)
|
5
|
+
end
|
6
|
+
|
7
|
+
def fetch(key)
|
8
|
+
Thread.current[:local_cache][key]
|
9
|
+
end
|
10
|
+
|
11
|
+
def store(key, rendered_tree, response_status, styles)
|
12
|
+
Thread.current[:local_cache][key] = [rendered_tree, response_status, styles]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|