mongrel_page_cache_handler 1.6.6 → 1.6.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cache_server.rb +7 -19
- data/lib/cacher.rb +5 -14
- data/lib/tasks/rubyforge_config.yml +1 -1
- metadata +2 -2
data/lib/cache_server.rb
CHANGED
@@ -5,25 +5,13 @@ module Mongrel
|
|
5
5
|
|
6
6
|
def process(request, response)
|
7
7
|
Mongrel::PageCacheHandler::Utils.do_work(request, response) do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
head["Content-Type"] = "text/html"
|
16
|
-
out.write(f)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
when "disk"
|
20
|
-
file_path = Mongrel::PageCacheHandler::Utils.build_full_file_path(request)
|
21
|
-
if File.exists?(file_path)
|
22
|
-
puts "We found: #{file_path} on the disk, let's render it"
|
23
|
-
response.start(200, true) do |head, out|
|
24
|
-
head["Content-Type"] = "text/html"
|
25
|
-
out.write(File.open(file_path).read)
|
26
|
-
end
|
8
|
+
file_path = Mongrel::PageCacheHandler::Utils.build_cachetastic_key(request)
|
9
|
+
f = Cachetastic::Caches::PageCache.get(file_path)
|
10
|
+
if f
|
11
|
+
puts "We found: #{file_path} in the cache, let's render it"
|
12
|
+
response.start(200, true) do |head, out|
|
13
|
+
head["Content-Type"] = "text/html"
|
14
|
+
out.write(f)
|
27
15
|
end
|
28
16
|
end
|
29
17
|
end
|
data/lib/cacher.rb
CHANGED
@@ -11,20 +11,11 @@ module Mongrel
|
|
11
11
|
mcm = sent["mongrel_cache_me"]
|
12
12
|
imcm = (sent["ignore_mongrel_cache_me"] || false)
|
13
13
|
if mcm && !imcm
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Cachetastic::Caches::PageCache.set(file_path, response.body.string)
|
20
|
-
when "disk"
|
21
|
-
file_path = Mongrel::PageCacheHandler::Utils.build_full_file_path(request, true)
|
22
|
-
puts "Let's cache this page: #{file_path} to the disk"
|
23
|
-
File.open(file_path, "w") do |f|
|
24
|
-
f.puts response.body.string
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
14
|
+
# file_path = Mongrel::PageCacheHandler::Utils.build_full_file_path(request, true)
|
15
|
+
file_path = Mongrel::PageCacheHandler::Utils.build_cachetastic_key(request)
|
16
|
+
puts "Let's cache this page: #{file_path} to the cache"
|
17
|
+
Cachetastic::Caches::PageCache.set(file_path, response.body.string)
|
18
|
+
end
|
28
19
|
end
|
29
20
|
end
|
30
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongrel_page_cache_handler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- markbates
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2008-01-
|
22
|
+
date: 2008-01-31 00:00:00 -05:00
|
23
23
|
default_executable:
|
24
24
|
dependencies: []
|
25
25
|
|