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 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
- case (app_config.page_cache_storage || "disk")
9
- when "cachetastic"
10
- file_path = Mongrel::PageCacheHandler::Utils.build_cachetastic_key(request)
11
- f = Cachetastic::Caches::PageCache.get(file_path)
12
- if f
13
- puts "We found: #{file_path} in the cache, let's render it"
14
- response.start(200, true) do |head, out|
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
- case app_config.page_cache_storage
15
- when "cachetastic"
16
- # file_path = Mongrel::PageCacheHandler::Utils.build_full_file_path(request, true)
17
- file_path = Mongrel::PageCacheHandler::Utils.build_cachetastic_key(request)
18
- puts "Let's cache this page: #{file_path} to the cache"
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
@@ -2,4 +2,4 @@
2
2
  gem_name: mongrel_page_cache_handler
3
3
  package: mongrel_page_cache_handler
4
4
  project: magrathea
5
- version: 1.6.6
5
+ version: 1.6.7
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.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 00:00:00 -05:00
22
+ date: 2008-01-31 00:00:00 -05:00
23
23
  default_executable:
24
24
  dependencies: []
25
25