rack-cache 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rack-cache might be problematic. Click here for more details.

@@ -176,13 +176,15 @@ module Rack::Cache
176
176
  end
177
177
 
178
178
  def read(key)
179
- @hash.fetch(key, []).collect do |req,res|
180
- [req.dup, res.dup]
179
+ if data = @hash[key]
180
+ Marshal.load(data)
181
+ else
182
+ []
181
183
  end
182
184
  end
183
185
 
184
186
  def write(key, entries)
185
- @hash[key] = entries
187
+ @hash[key] = Marshal.dump(entries)
186
188
  end
187
189
 
188
190
  def purge(key)
data/rack-cache.gemspec CHANGED
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = 'rack-cache'
6
- s.version = '1.0.1'
7
- s.date = '2011-04-13'
6
+ s.version = '1.0.2'
7
+ s.date = '2011-05-16'
8
8
 
9
9
  s.description = "HTTP Caching for Rack"
10
10
  s.summary = "HTTP Caching for Rack"
data/test/context_test.rb CHANGED
@@ -574,8 +574,14 @@ describe 'Rack::Cache::Context' do
574
574
  response.body.should.equal 'Hello World'
575
575
 
576
576
  # go in and play around with the cached metadata directly ...
577
- cache.metastore.to_hash.values.length.should.equal 1
578
- cache.metastore.to_hash.values.first.first[1]['Expires'] = Time.now.httpdate
577
+ # XXX find some other way to do this
578
+ hash = cache.metastore.to_hash
579
+ hash.values.length.should.equal 1
580
+ entries = Marshal.load(hash.values.first)
581
+ entries.length.should.equal 1
582
+ req, res = entries.first
583
+ res['Expires'] = (Time.now - 1).httpdate
584
+ hash[hash.keys.first] = Marshal.dump([[req, res]])
579
585
 
580
586
  # build subsequent request; should be found but miss due to freshness
581
587
  get '/'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: rack-cache
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.1
5
+ version: 1.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ryan Tomayko
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-13 00:00:00 +01:00
13
+ date: 2011-05-16 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency