rack-cache 1.0.2 → 1.0.3
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.
- data/Gemfile +7 -0
- data/doc/configuration.markdown +16 -1
- data/lib/rack/cache/entitystore.rb +1 -1
- data/lib/rack/cache/metastore.rb +1 -1
- data/rack-cache.gemspec +3 -2
- data/test/entitystore_test.rb +10 -0
- data/test/metastore_test.rb +10 -0
- metadata +55 -61
data/Gemfile
ADDED
data/doc/configuration.markdown
CHANGED
@@ -109,4 +109,19 @@ a refresh (e.g., clicking the "Refresh" button).
|
|
109
109
|
|
110
110
|
### `cache_key`
|
111
111
|
|
112
|
-
|
112
|
+
A custom cache key generator, which can be anything that responds to :call.
|
113
|
+
By default, this is the `Rack::Cache::Key` class, but you can implement your own
|
114
|
+
generator. A cache key generator gets passed a `Rack::Request` object and generates
|
115
|
+
the appropriate cache key.
|
116
|
+
|
117
|
+
The `Rack::Cache::Key` class by default returns the fully qualified url of the request.
|
118
|
+
|
119
|
+
In addition to setting the generator to an object, you can just pass a block instead,
|
120
|
+
which will act as the cache key generator:
|
121
|
+
|
122
|
+
set :cache_key do |request|
|
123
|
+
request.fullpath.replace(/\//, '-')
|
124
|
+
end
|
125
|
+
|
126
|
+
For more options see the [Rack::Request documentation](http://rack.rubyforge.org/doc/classes/Rack/Request.html)
|
127
|
+
|
data/lib/rack/cache/metastore.rb
CHANGED
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.
|
7
|
-
s.date = '2011-
|
6
|
+
s.version = '1.0.3'
|
7
|
+
s.date = '2011-08-27'
|
8
8
|
|
9
9
|
s.description = "HTTP Caching for Rack"
|
10
10
|
s.summary = "HTTP Caching for Rack"
|
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.files = %w[
|
17
17
|
CHANGES
|
18
18
|
COPYING
|
19
|
+
Gemfile
|
19
20
|
README
|
20
21
|
Rakefile
|
21
22
|
TODO
|
data/test/entitystore_test.rb
CHANGED
@@ -185,6 +185,11 @@ describe 'Rack::Cache::EntityStore' do
|
|
185
185
|
end
|
186
186
|
behaves_like 'A Rack::Cache::EntityStore Implementation'
|
187
187
|
end
|
188
|
+
|
189
|
+
it 'passes options from uri' do
|
190
|
+
memcached = Rack::Cache::EntityStore::Dalli.resolve URI.parse("memcached://#{ENV['MEMCACHED']}?show_backtraces=true")
|
191
|
+
memcached.cache.instance_variable_get(:@options)[:show_backtraces].should.equal true
|
192
|
+
end
|
188
193
|
end
|
189
194
|
|
190
195
|
|
@@ -198,6 +203,11 @@ describe 'Rack::Cache::EntityStore' do
|
|
198
203
|
@store = nil
|
199
204
|
end
|
200
205
|
behaves_like 'A Rack::Cache::EntityStore Implementation'
|
206
|
+
|
207
|
+
it 'passes options from uri' do
|
208
|
+
dalli = Rack::Cache::EntityStore::Dalli.resolve URI.parse("memcached://#{ENV['MEMCACHED']}?compression=true")
|
209
|
+
dalli.cache.instance_variable_get(:@options)[:compression].should.equal true
|
210
|
+
end
|
201
211
|
end
|
202
212
|
end
|
203
213
|
|
data/test/metastore_test.rb
CHANGED
@@ -265,6 +265,11 @@ describe 'Rack::Cache::MetaStore' do
|
|
265
265
|
end
|
266
266
|
behaves_like 'A Rack::Cache::MetaStore Implementation'
|
267
267
|
end
|
268
|
+
|
269
|
+
it 'passes options from uri' do
|
270
|
+
memcached = Rack::Cache::EntityStore::Dalli.resolve URI.parse("memcached://#{ENV['MEMCACHED']}?show_backtraces=true")
|
271
|
+
memcached.cache.instance_variable_get(:@options)[:show_backtraces].should.equal true
|
272
|
+
end
|
268
273
|
end
|
269
274
|
|
270
275
|
need_dalli 'metastore tests' do
|
@@ -277,6 +282,11 @@ describe 'Rack::Cache::MetaStore' do
|
|
277
282
|
end
|
278
283
|
behaves_like 'A Rack::Cache::MetaStore Implementation'
|
279
284
|
end
|
285
|
+
|
286
|
+
it 'passes options from uri' do
|
287
|
+
dalli = Rack::Cache::EntityStore::Dalli.resolve URI.parse("memcached://#{ENV['MEMCACHED']}?compression=true")
|
288
|
+
dalli.cache.instance_variable_get(:@options)[:compression].should.equal true
|
289
|
+
end
|
280
290
|
end
|
281
291
|
|
282
292
|
need_java 'entity store testing' do
|
metadata
CHANGED
@@ -1,76 +1,73 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-cache
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
4
5
|
prerelease:
|
5
|
-
version: 1.0.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Ryan Tomayko
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-08-27 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: rack
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70303071454760 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
22
|
-
- -
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.4'
|
25
22
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bacon
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: *70303071454760
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: bacon
|
27
|
+
requirement: &70303071454380 !ruby/object:Gem::Requirement
|
31
28
|
none: false
|
32
|
-
requirements:
|
33
|
-
- -
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
36
33
|
type: :development
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: memcached
|
40
34
|
prerelease: false
|
41
|
-
|
35
|
+
version_requirements: *70303071454380
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: memcached
|
38
|
+
requirement: &70303071453920 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
47
44
|
type: :development
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: dalli
|
51
45
|
prerelease: false
|
52
|
-
|
46
|
+
version_requirements: *70303071453920
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: dalli
|
49
|
+
requirement: &70303071453500 !ruby/object:Gem::Requirement
|
53
50
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
58
55
|
type: :development
|
59
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70303071453500
|
60
58
|
description: HTTP Caching for Rack
|
61
59
|
email: r@tomayko.com
|
62
60
|
executables: []
|
63
|
-
|
64
61
|
extensions: []
|
65
|
-
|
66
|
-
extra_rdoc_files:
|
62
|
+
extra_rdoc_files:
|
67
63
|
- README
|
68
64
|
- COPYING
|
69
65
|
- TODO
|
70
66
|
- CHANGES
|
71
|
-
files:
|
67
|
+
files:
|
72
68
|
- CHANGES
|
73
69
|
- COPYING
|
70
|
+
- Gemfile
|
74
71
|
- README
|
75
72
|
- Rakefile
|
76
73
|
- TODO
|
@@ -109,40 +106,37 @@ files:
|
|
109
106
|
- test/response_test.rb
|
110
107
|
- test/spec_setup.rb
|
111
108
|
- test/storage_test.rb
|
112
|
-
has_rdoc: true
|
113
109
|
homepage: http://tomayko.com/src/rack-cache/
|
114
110
|
licenses: []
|
115
|
-
|
116
111
|
post_install_message:
|
117
|
-
rdoc_options:
|
112
|
+
rdoc_options:
|
118
113
|
- --line-numbers
|
119
114
|
- --inline-source
|
120
115
|
- --title
|
121
116
|
- Rack::Cache
|
122
117
|
- --main
|
123
118
|
- Rack::Cache
|
124
|
-
require_paths:
|
119
|
+
require_paths:
|
125
120
|
- lib
|
126
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
122
|
none: false
|
128
|
-
requirements:
|
129
|
-
- -
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version:
|
132
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
128
|
none: false
|
134
|
-
requirements:
|
135
|
-
- -
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version:
|
129
|
+
requirements:
|
130
|
+
- - ! '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
138
133
|
requirements: []
|
139
|
-
|
140
134
|
rubyforge_project:
|
141
|
-
rubygems_version: 1.6
|
135
|
+
rubygems_version: 1.8.6
|
142
136
|
signing_key:
|
143
137
|
specification_version: 2
|
144
138
|
summary: HTTP Caching for Rack
|
145
|
-
test_files:
|
139
|
+
test_files:
|
146
140
|
- test/cache_test.rb
|
147
141
|
- test/cachecontrol_test.rb
|
148
142
|
- test/context_test.rb
|