rack-cache 1.14.0 → 1.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/cache/entity_store.rb +1 -7
- data/lib/rack/cache/headers.rb +21 -0
- data/lib/rack/cache/meta_store.rb +2 -1
- data/lib/rack/cache/response.rb +3 -11
- data/lib/rack/cache/version.rb +1 -1
- metadata +7 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2edcf7ffd2a3b9c5ba66abcdc566caf900f9068461a585f67c17a4738a33daa
|
4
|
+
data.tar.gz: f099844a7d9b46df7fa513a242e945845cf9eaec0361e5d94ca9d5b2967025bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c8c4d4a74af314173a719e46d9121dca7bb32861abde387ea6512fef37a2b7ca1a46c337d6e6e65d73c148b45ac34dc3f16b350550c956c7ab5f285cbfe8a27
|
7
|
+
data.tar.gz: '09258a5cbdf83683ca810e416e4f7898811fd0a2263d49b692a8f0299285aa2df8089adff28c79bb5a1bf7962eee6eb0107a56835ed4d58b1cedcdecf4545fbe'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Rack::Cache
|
2
|
+
begin
|
3
|
+
# For `Rack::Headers` (Rack 3+):
|
4
|
+
require "rack/headers"
|
5
|
+
Headers = ::Rack::Headers
|
6
|
+
def self.Headers(headers)
|
7
|
+
Headers[headers]
|
8
|
+
end
|
9
|
+
rescue LoadError
|
10
|
+
# For `Rack::Utils::HeaderHash`:
|
11
|
+
require "rack/utils"
|
12
|
+
Headers = ::Rack::Utils::HeaderHash
|
13
|
+
def self.Headers(headers)
|
14
|
+
if headers.is_a?(Headers) && !headers.frozen?
|
15
|
+
return headers
|
16
|
+
else
|
17
|
+
return Headers.new(headers)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -38,7 +38,8 @@ module Rack::Cache
|
|
38
38
|
return nil if match.nil?
|
39
39
|
|
40
40
|
_, res = match
|
41
|
-
|
41
|
+
entity_key = res['x-content-digest']
|
42
|
+
if entity_key && body = entity_store.open(entity_key)
|
42
43
|
restore_response(res, body)
|
43
44
|
else
|
44
45
|
# the metastore referenced an entity that doesn't exist in
|
data/lib/rack/cache/response.rb
CHANGED
@@ -3,17 +3,9 @@ require 'set'
|
|
3
3
|
require 'rack/response'
|
4
4
|
require 'rack/cache/cache_control'
|
5
5
|
|
6
|
-
|
7
|
-
begin
|
8
|
-
# For `Rack::Headers` (Rack 3+):
|
9
|
-
require "rack/headers"
|
10
|
-
Headers = ::Rack::Headers
|
11
|
-
rescue LoadError
|
12
|
-
# For `Rack::Utils::HeaderHash`:
|
13
|
-
require "rack/utils"
|
14
|
-
Headers = ::Rack::Utils::HeaderHash
|
15
|
-
end
|
6
|
+
require_relative 'headers'
|
16
7
|
|
8
|
+
module Rack::Cache
|
17
9
|
# Provides access to the response generated by the downstream application. The
|
18
10
|
# +response+, +original_response+, and +entry+ objects exposed by the Core
|
19
11
|
# caching engine are instances of this class.
|
@@ -39,7 +31,7 @@ module Rack::Cache
|
|
39
31
|
# and body.
|
40
32
|
def initialize(status, headers, body)
|
41
33
|
@status = status.to_i
|
42
|
-
@headers = Headers
|
34
|
+
@headers = Rack::Cache::Headers(headers)
|
43
35
|
@body = body
|
44
36
|
@now = Time.now
|
45
37
|
@headers['date'] ||= @now.httpdate
|
data/lib/rack/cache/version.rb
CHANGED
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.
|
4
|
+
version: 1.16.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:
|
11
|
+
date: 2024-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: mocha
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: mutex_m
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rdiscount
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: hanna-nouveau
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,6 +145,7 @@ files:
|
|
159
145
|
- lib/rack/cache/context.rb
|
160
146
|
- lib/rack/cache/entity_store.rb
|
161
147
|
- lib/rack/cache/entitystore.rb
|
148
|
+
- lib/rack/cache/headers.rb
|
162
149
|
- lib/rack/cache/key.rb
|
163
150
|
- lib/rack/cache/meta_store.rb
|
164
151
|
- lib/rack/cache/metastore.rb
|
@@ -185,14 +172,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
172
|
requirements:
|
186
173
|
- - ">="
|
187
174
|
- !ruby/object:Gem::Version
|
188
|
-
version: 2.
|
175
|
+
version: 2.7.7
|
189
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
177
|
requirements:
|
191
178
|
- - ">="
|
192
179
|
- !ruby/object:Gem::Version
|
193
180
|
version: '0'
|
194
181
|
requirements: []
|
195
|
-
rubygems_version: 3.
|
182
|
+
rubygems_version: 3.5.3
|
196
183
|
signing_key:
|
197
184
|
specification_version: 4
|
198
185
|
summary: HTTP Caching for Rack
|