seo_cache 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/seo_cache/middleware.rb +8 -3
- data/lib/seo_cache/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dde4a37e1374c8be6416313e684356041177425e0cf5c2466d4fc7c60818626d
|
4
|
+
data.tar.gz: 9e5879c7af42860ff332e06eb36343cd650bf8a89c634b386a8073059d9c4aa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a391af74f2c3d9848cce8bb4b1daa228c3296e019bed8ab1126dda1b9a52825351a885bfd9c2067671f8ff645a4bb7b88d36d1fb8298790e04c48e36ab93daf5
|
7
|
+
data.tar.gz: 8aa95c5b23d5120b1a5848d115ed3ceb75ec2019abaf507a7bcf076fa9d391ffe750f1750bbcc4b484d497303544f68ab33788a11bd88a6d1bc5c10aae95f682
|
data/CHANGELOG.md
CHANGED
data/lib/seo_cache/middleware.rb
CHANGED
@@ -22,7 +22,7 @@ module SeoCache
|
|
22
22
|
return cached_response.finish if cached_response.present?
|
23
23
|
|
24
24
|
if SeoCache.log_missed_cache
|
25
|
-
env_request =
|
25
|
+
env_request = Rack::Request.new(env)
|
26
26
|
SeoCache.log("missed cache : #{env_request.path} (User agent: #{env_request.user_agent})")
|
27
27
|
end
|
28
28
|
|
@@ -36,8 +36,8 @@ module SeoCache
|
|
36
36
|
else
|
37
37
|
Thread.new do
|
38
38
|
prerender_data = page_render(env)
|
39
|
-
# Extract status from render page
|
40
|
-
status = prerender_data&.scan(/<!--status:(\d+)-->/)&.last&.first ||
|
39
|
+
# Extract status from render page or return 404
|
40
|
+
status = prerender_data&.scan(/<!--status:(\d+)-->/)&.last&.first || 404
|
41
41
|
after_render(env, prerender_data, status || 200)
|
42
42
|
end
|
43
43
|
end
|
@@ -207,6 +207,11 @@ module SeoCache
|
|
207
207
|
def after_render(env, response, status = 200)
|
208
208
|
return unless response && SeoCache.cache_only_status.include?(status.to_i)
|
209
209
|
|
210
|
+
if SeoCache.log_missed_cache
|
211
|
+
env_request = Rack::Request.new(env)
|
212
|
+
SeoCache.log("missed cache : #{env_request.path} (User agent: #{env_request.user_agent})")
|
213
|
+
end
|
214
|
+
|
210
215
|
@page_caching.cache(response, Rack::Request.new(env).path)
|
211
216
|
end
|
212
217
|
end
|
data/lib/seo_cache/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seo_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FloXcoder
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|