markbates-rack_page_caching 0.1.3 → 0.1.4

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.
@@ -22,7 +22,7 @@ unless ActionController.const_defined?('CONFIGURED_PAGE_CACHING_EXTENSIONS')
22
22
  def read_from_rack_page_cache
23
23
  begin
24
24
  if request.get? && configatron.rack.caching.use_page_caching
25
- cpage = Cachetastic::Caches::PageCache.get(request.url)
25
+ cpage = Cachetastic::Caches::PageCache.get(Rack::PageCaching::Middleware.generate_key(request.url))
26
26
  if cpage
27
27
  response.headers["Content-Type"] = cpage.content_type
28
28
  render(:text => cpage.body, :layout => false)
@@ -12,7 +12,7 @@ module Rack
12
12
  request = Rack::Request.new(env)
13
13
  if request.get?
14
14
  begin
15
- page = Cachetastic::Caches::PageCache.get(request.fullpath)
15
+ page = Cachetastic::Caches::PageCache.get(Rack::PageCaching::Middleware.generate_key(request.fullpath))
16
16
  if page
17
17
  response = Rack::Response.new
18
18
  response["Content-Type"] = page.content_type
@@ -84,7 +84,7 @@ module Rack
84
84
 
85
85
  def set_into_cache(url, body, content_type, expiry = configatron.cachetastic_caches_page_cache_options.default_expiry)
86
86
  begin
87
- Cachetastic::Caches::PageCache.set(url,
87
+ Cachetastic::Caches::PageCache.set(Rack::PageCaching::Middleware.generate_key(url),
88
88
  Rack::PageCaching::Middleware::Page.new(body, content_type),
89
89
  expiry.to_i)
90
90
  rescue Exception => e
@@ -92,6 +92,10 @@ module Rack
92
92
  end
93
93
  end
94
94
 
95
+ def generate_key(url)
96
+ Digest::SHA1.hexdigest(url)
97
+ end
98
+
95
99
  end # class << self
96
100
 
97
101
  end # Middleware
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markbates-rack_page_caching
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - markbates
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-26 00:00:00 -07:00
12
+ date: 2009-04-13 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency