seo_cache 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/seo_cache/page_caching.rb +11 -11
- data/lib/seo_cache/populate_cache.rb +2 -3
- data/lib/seo_cache/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36c446ef0dc5b6781157d81939f519c60e024ef6b4b0a9709b23f71cf2a96684
|
4
|
+
data.tar.gz: 73f5a4fe10538b1292e8482d82f7411da4380ded38bcb13ba3b1565a3267576e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e4f9582ca1e55fabd778adedec0cef4f715ea8fa78e3be1fc85a3982f2e4c8a48dfa8954154208735d5a7daf02c7f8da682c8b5f96d008bf5f8a829706d2f77
|
7
|
+
data.tar.gz: 2c6c965ec2cb3621f10e91f8cc75bad2d032825dfebe629cf0a023a74382b3676550f9060c68deb110b21429381e5e4127938c2b5aa2da839925436e7ec32ccc
|
data/CHANGELOG.md
CHANGED
@@ -17,12 +17,12 @@ module SeoCache
|
|
17
17
|
@redis.get(cache_path(path, extension)) if SeoCache.memory_cache? && @redis
|
18
18
|
end
|
19
19
|
|
20
|
-
def cache(content, path, extension = nil, gzip = Zlib::BEST_COMPRESSION)
|
20
|
+
def cache(content, path, locale_domain = nil, extension = nil, gzip = Zlib::BEST_COMPRESSION)
|
21
21
|
instrument :write_page, path do
|
22
22
|
if SeoCache.memory_cache? && @redis
|
23
|
-
write_to_memory(content, cache_path(path, extension))
|
23
|
+
write_to_memory(content, cache_path(path, extension, locale_domain))
|
24
24
|
else
|
25
|
-
write_to_disk(content, cache_path(path, extension), gzip)
|
25
|
+
write_to_disk(content, cache_path(path, extension, locale_domain), gzip)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -51,22 +51,22 @@ module SeoCache
|
|
51
51
|
SeoCache.cache_extension
|
52
52
|
end
|
53
53
|
|
54
|
-
def cache_file(path, extension)
|
54
|
+
def cache_file(path, extension, locale_domain)
|
55
55
|
name = if path.empty? || path =~ %r{\A/+\z}
|
56
56
|
'/index'
|
57
57
|
else
|
58
58
|
URI::Parser.new.unescape(path.chomp('/'))
|
59
59
|
end
|
60
60
|
|
61
|
-
if
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
61
|
+
name = "#{locale_domain}/#{name}" if locale_domain
|
62
|
+
|
63
|
+
name += extension || default_extension if File.extname(name).empty?
|
64
|
+
|
65
|
+
name
|
66
66
|
end
|
67
67
|
|
68
|
-
def cache_path(path, extension = nil)
|
69
|
-
File.join(cache_directory, cache_file(path, extension))
|
68
|
+
def cache_path(path, extension = nil, locale_domain = nil)
|
69
|
+
File.join(cache_directory, cache_file(path, extension, locale_domain))
|
70
70
|
end
|
71
71
|
|
72
72
|
def write_to_memory(content, path)
|
@@ -34,7 +34,7 @@ module SeoCache
|
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
-
def generate_cache(path,
|
37
|
+
def generate_cache(path, locale_domain = nil)
|
38
38
|
return if @page_caching.cache_exists?(path) && !@force_cache
|
39
39
|
|
40
40
|
url = @host + path
|
@@ -44,8 +44,7 @@ module SeoCache
|
|
44
44
|
page_source = @page_render.get(url, false)
|
45
45
|
return unless page_source
|
46
46
|
|
47
|
-
|
48
|
-
@page_caching.cache(page_source, path_cache_key)
|
47
|
+
@page_caching.cache(page_source, path, locale_domain)
|
49
48
|
end
|
50
49
|
end
|
51
50
|
end
|
data/lib/seo_cache/version.rb
CHANGED