rack-cache 1.6.1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +8 -0
  3. data/lib/rack/cache/meta_store.rb +14 -8
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad5318e23250e33645116d216dc29c802474689c
4
- data.tar.gz: 80b52176a3aa9229f4fc4178e3123e973e10001e
3
+ metadata.gz: dfb0b7e413146e05683b9ee05ea5284209929be6
4
+ data.tar.gz: e78fae89f8f289829573052c82d7f17dd2f5e597
5
5
  SHA512:
6
- metadata.gz: 58e6d9f8cd0cae110dc4fa923d0383973f085fa4e33f416318c7b48783a2d746278ec0e50b98a20dda55d669ef4016c10fe36693d49733f457fa630461cedea8
7
- data.tar.gz: f30d08c7334ea19d00550d389e98940f62353fd93d15a65c3fd431c93a6c3b0ea23fc7e748bc51bc7646fa33f47c33061a55e03878368367ca743da762eea0a8
6
+ metadata.gz: 2f9fc1f96cfd00a4f567f0c5824653f00d796041e046b1ab082cbdc53698d0455d8f91ce55279dd56268e227c2237b670d84913fc580e8be6a5bafb0977d19b3
7
+ data.tar.gz: 358deaeffc3dcebe11544ef7b1c458a6cb3b62f5e2ae38ac05faa51d4fc2ebde155a496088df7b559d8780629aaee03bdceaec5e95c980a659aba606b8f94490
data/CHANGES CHANGED
@@ -1,3 +1,11 @@
1
+ ## 1.7.0
2
+
3
+ * Meta stores now receive a third ttl argument to write when use_native_ttl is used.
4
+
5
+ ## 1.6.1
6
+
7
+ * Revert 'No longer read responses from cache when we already have them'
8
+
1
9
  ## 1.6.0
2
10
 
3
11
  * Noop backend
@@ -91,7 +91,11 @@ module Rack::Cache
91
91
  headers.delete 'Age'
92
92
 
93
93
  entries.unshift [stored_env, headers]
94
- write key, entries
94
+ if request.env['rack-cache.use_native_ttl'] && response.fresh?
95
+ write key, entries, response.ttl
96
+ else
97
+ write key, entries
98
+ end
95
99
  key
96
100
  end
97
101
 
@@ -165,7 +169,7 @@ module Rack::Cache
165
169
  # Store an Array of request/response pairs for the given key. Concrete
166
170
  # implementations should not attempt to filter or concatenate the
167
171
  # list in any way.
168
- def write(key, negotiations)
172
+ def write(key, negotiations, ttl = nil)
169
173
  raise NotImplementedError
170
174
  end
171
175
 
@@ -198,7 +202,7 @@ module Rack::Cache
198
202
  end
199
203
  end
200
204
 
201
- def write(key, entries)
205
+ def write(key, entries, ttl = nil)
202
206
  @hash[key] = Marshal.dump(entries)
203
207
  end
204
208
 
@@ -236,7 +240,7 @@ module Rack::Cache
236
240
  []
237
241
  end
238
242
 
239
- def write(key, entries)
243
+ def write(key, entries, ttl = nil)
240
244
  tries = 0
241
245
  begin
242
246
  path = key_path(key)
@@ -335,9 +339,10 @@ module Rack::Cache
335
339
  cache.get(key) || []
336
340
  end
337
341
 
338
- def write(key, entries)
342
+ # Default TTL to zero, interpreted as "don't expire" by Memcached.
343
+ def write(key, entries, ttl = 0)
339
344
  key = hexdigest(key)
340
- cache.set(key, entries)
345
+ cache.set(key, entries, ttl)
341
346
  end
342
347
 
343
348
  def purge(key)
@@ -369,9 +374,10 @@ module Rack::Cache
369
374
  []
370
375
  end
371
376
 
372
- def write(key, entries)
377
+ # Default TTL to zero, interpreted as "don't expire" by Memcached.
378
+ def write(key, entries, ttl = 0)
373
379
  key = hexdigest(key)
374
- cache.set(key, entries)
380
+ cache.set(key, entries, ttl)
375
381
  end
376
382
 
377
383
  def purge(key)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Tomayko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-11 00:00:00.000000000 Z
11
+ date: 2017-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  requirements: []
166
166
  rubyforge_project:
167
- rubygems_version: 2.4.5.1
167
+ rubygems_version: 2.5.1
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: HTTP Caching for Rack