cached_resource 5.2.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +28 -0
- data/Appraisals +18 -1
- data/README.md +7 -1
- data/gemfiles/4.2.gemfile +2 -0
- data/gemfiles/4.2.gemfile.lock +3 -1
- data/gemfiles/5.0.gemfile.lock +1 -1
- data/gemfiles/5.1.gemfile.lock +1 -1
- data/gemfiles/6.0.gemfile +7 -0
- data/gemfiles/6.0.gemfile.lock +172 -0
- data/gemfiles/6.1.gemfile +7 -0
- data/gemfiles/6.1.gemfile.lock +175 -0
- data/gemfiles/7.0.gemfile +7 -0
- data/gemfiles/7.0.gemfile.lock +193 -0
- data/lib/cached_resource/caching.rb +8 -0
- data/lib/cached_resource/configuration.rb +4 -2
- data/lib/cached_resource/version.rb +1 -1
- data/spec/cached_resource/caching_spec.rb +34 -1
- data/spec/cached_resource/configuration_spec.rb +12 -3
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1db920707ba1bb3a1ba5c619c316ea9a1a0c932b9852231f312178a15952ac43
|
4
|
+
data.tar.gz: 7bb62db4f9df25eb585ab2d1a7605ed5b4ca0811df2e83cb19be9adefd039be0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7f06dba0aaf189395a70fc6c5d8e7d97a5e48e327f2d73fdc192b9bb3b911b85e01bff9cdda67aad53c91d471df59bb5b3db808f3eac5c92f9a881c41a7347b
|
7
|
+
data.tar.gz: 307f61951d5ac54b1c28677253b862a8857b79358afe7abb8504849b8da902bfba1ae05bda6231aa34044d1f0eaa0228fd4794ccf25e6acf5406df7747840fcc
|
data/.travis.yml
CHANGED
@@ -8,8 +8,36 @@ rvm:
|
|
8
8
|
- 2.2.4
|
9
9
|
- 2.3.4
|
10
10
|
- 2.4.1
|
11
|
+
- 2.5.8
|
12
|
+
- 2.7.2
|
11
13
|
|
12
14
|
gemfile:
|
13
15
|
- gemfiles/4.2.gemfile
|
14
16
|
- gemfiles/5.0.gemfile
|
15
17
|
- gemfiles/5.1.gemfile
|
18
|
+
- gemfiles/6.0.gemfile
|
19
|
+
- gemfiles/6.1.gemfile
|
20
|
+
- gemfiles/7.0.gemfile
|
21
|
+
|
22
|
+
jobs:
|
23
|
+
exclude:
|
24
|
+
- rvm: 2.2.4
|
25
|
+
gemfile: gemfiles/6.0.gemfile
|
26
|
+
- rvm: 2.3.4
|
27
|
+
gemfile: gemfiles/6.0.gemfile
|
28
|
+
- rvm: 2.4.1
|
29
|
+
gemfile: gemfiles/6.0.gemfile
|
30
|
+
- rvm: 2.2.4
|
31
|
+
gemfile: gemfiles/6.1.gemfile
|
32
|
+
- rvm: 2.3.4
|
33
|
+
gemfile: gemfiles/6.1.gemfile
|
34
|
+
- rvm: 2.4.1
|
35
|
+
gemfile: gemfiles/6.1.gemfile
|
36
|
+
- rvm: 2.2.4
|
37
|
+
gemfile: gemfiles/7.0.gemfile
|
38
|
+
- rvm: 2.3.4
|
39
|
+
gemfile: gemfiles/7.0.gemfile
|
40
|
+
- rvm: 2.4.1
|
41
|
+
gemfile: gemfiles/7.0.gemfile
|
42
|
+
- rvm: 2.5.8
|
43
|
+
gemfile: gemfiles/7.0.gemfile
|
data/Appraisals
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
appraise "4.2" do
|
2
2
|
gem "rails", "~> 4.2.0"
|
3
|
+
# https://stackoverflow.com/questions/60226893/rails-nomethoderror-undefined-method-new-for-bigdecimalclass
|
4
|
+
gem "bigdecimal", "1.3.5"
|
3
5
|
end
|
4
6
|
|
5
7
|
appraise "5.0" do
|
@@ -8,4 +10,19 @@ end
|
|
8
10
|
|
9
11
|
appraise "5.1" do
|
10
12
|
gem "rails", "~> 5.1.0"
|
11
|
-
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# requires ruby >= 2.5.0
|
16
|
+
appraise "6.0" do
|
17
|
+
gem "rails", "~> 6.0.0"
|
18
|
+
end
|
19
|
+
|
20
|
+
# requires ruby >= 2.5.0
|
21
|
+
appraise "6.1" do
|
22
|
+
gem "rails", "~> 6.1.0"
|
23
|
+
end
|
24
|
+
|
25
|
+
# requires ruby >= 2.7.0
|
26
|
+
appraise "7.0" do
|
27
|
+
gem "rails", "~> 7.0.0"
|
28
|
+
end
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# CachedResource [![Build Status](https://travis-ci.
|
1
|
+
# CachedResource [![Build Status](https://app.travis-ci.com/mhgbrown/cached_resource.svg?branch=master)](https://app.travis-ci.com/github/mhgbrown/cached_resource)
|
2
2
|
CachedResource is a Ruby gem whose goal is to increase the performance of interacting with web services via ActiveResource by caching responses based on request parameters. It can help reduce the lag created by making repeated requests across a network.
|
3
3
|
|
4
4
|
## Installation
|
@@ -13,6 +13,8 @@ CachedResource supports the following Ruby versions:
|
|
13
13
|
* 2.2.x
|
14
14
|
* 2.3.x
|
15
15
|
* 2.4.x
|
16
|
+
* 2.5.x
|
17
|
+
* 2.7.x
|
16
18
|
|
17
19
|
...and likely other modern Ruby versions. If you require 1.8.7 support, please use version 2.3.4.
|
18
20
|
|
@@ -21,6 +23,9 @@ CachedResource is designed to be framework agnostic, but will hook into Rails fo
|
|
21
23
|
* 4.2.x
|
22
24
|
* 5.0.x
|
23
25
|
* 5.1.x
|
26
|
+
* 6.0.x
|
27
|
+
* 6.1.x
|
28
|
+
* 7.0.x
|
24
29
|
|
25
30
|
For previously supported versions, use 4.2.0 or below.
|
26
31
|
|
@@ -53,6 +58,7 @@ CachedResource accepts the following options:
|
|
53
58
|
* `:collection_arguments` The arguments that identify the principal collection request. Default: `[:all]`
|
54
59
|
* `:logger` The logger to which CachedResource messages should be written. Default: The `Rails.logger` if available, or an `ActiveSupport::Logger`
|
55
60
|
* `:cache` The cache store that CacheResource should use. Default: The `Rails.cache` if available, or an `ActiveSupport::Cache::MemoryStore`
|
61
|
+
* `:cache_collections` Set to false to always remake a request for collections. Default: `true`
|
56
62
|
|
57
63
|
You can set them like this:
|
58
64
|
|
data/gemfiles/4.2.gemfile
CHANGED
data/gemfiles/4.2.gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
cached_resource (5.
|
4
|
+
cached_resource (5.3.0)
|
5
5
|
activeresource (>= 4.0)
|
6
6
|
activesupport (>= 4.0)
|
7
7
|
nilio (>= 1.0)
|
@@ -52,6 +52,7 @@ GEM
|
|
52
52
|
rake
|
53
53
|
thor (>= 0.14.0)
|
54
54
|
arel (6.0.4)
|
55
|
+
bigdecimal (1.3.5)
|
55
56
|
builder (3.2.3)
|
56
57
|
concurrent-ruby (1.0.5)
|
57
58
|
diff-lcs (1.3)
|
@@ -131,6 +132,7 @@ PLATFORMS
|
|
131
132
|
|
132
133
|
DEPENDENCIES
|
133
134
|
appraisal
|
135
|
+
bigdecimal (= 1.3.5)
|
134
136
|
cached_resource!
|
135
137
|
rails (~> 4.2.0)
|
136
138
|
rake
|
data/gemfiles/5.0.gemfile.lock
CHANGED
data/gemfiles/5.1.gemfile.lock
CHANGED
@@ -0,0 +1,172 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
cached_resource (5.3.0)
|
5
|
+
activeresource (>= 4.0)
|
6
|
+
activesupport (>= 4.0)
|
7
|
+
nilio (>= 1.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
actioncable (6.0.4.1)
|
13
|
+
actionpack (= 6.0.4.1)
|
14
|
+
nio4r (~> 2.0)
|
15
|
+
websocket-driver (>= 0.6.1)
|
16
|
+
actionmailbox (6.0.4.1)
|
17
|
+
actionpack (= 6.0.4.1)
|
18
|
+
activejob (= 6.0.4.1)
|
19
|
+
activerecord (= 6.0.4.1)
|
20
|
+
activestorage (= 6.0.4.1)
|
21
|
+
activesupport (= 6.0.4.1)
|
22
|
+
mail (>= 2.7.1)
|
23
|
+
actionmailer (6.0.4.1)
|
24
|
+
actionpack (= 6.0.4.1)
|
25
|
+
actionview (= 6.0.4.1)
|
26
|
+
activejob (= 6.0.4.1)
|
27
|
+
mail (~> 2.5, >= 2.5.4)
|
28
|
+
rails-dom-testing (~> 2.0)
|
29
|
+
actionpack (6.0.4.1)
|
30
|
+
actionview (= 6.0.4.1)
|
31
|
+
activesupport (= 6.0.4.1)
|
32
|
+
rack (~> 2.0, >= 2.0.8)
|
33
|
+
rack-test (>= 0.6.3)
|
34
|
+
rails-dom-testing (~> 2.0)
|
35
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
+
actiontext (6.0.4.1)
|
37
|
+
actionpack (= 6.0.4.1)
|
38
|
+
activerecord (= 6.0.4.1)
|
39
|
+
activestorage (= 6.0.4.1)
|
40
|
+
activesupport (= 6.0.4.1)
|
41
|
+
nokogiri (>= 1.8.5)
|
42
|
+
actionview (6.0.4.1)
|
43
|
+
activesupport (= 6.0.4.1)
|
44
|
+
builder (~> 3.1)
|
45
|
+
erubi (~> 1.4)
|
46
|
+
rails-dom-testing (~> 2.0)
|
47
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
48
|
+
activejob (6.0.4.1)
|
49
|
+
activesupport (= 6.0.4.1)
|
50
|
+
globalid (>= 0.3.6)
|
51
|
+
activemodel (6.0.4.1)
|
52
|
+
activesupport (= 6.0.4.1)
|
53
|
+
activemodel-serializers-xml (1.0.2)
|
54
|
+
activemodel (> 5.x)
|
55
|
+
activesupport (> 5.x)
|
56
|
+
builder (~> 3.1)
|
57
|
+
activerecord (6.0.4.1)
|
58
|
+
activemodel (= 6.0.4.1)
|
59
|
+
activesupport (= 6.0.4.1)
|
60
|
+
activeresource (5.1.1)
|
61
|
+
activemodel (>= 5.0, < 7)
|
62
|
+
activemodel-serializers-xml (~> 1.0)
|
63
|
+
activesupport (>= 5.0, < 7)
|
64
|
+
activestorage (6.0.4.1)
|
65
|
+
actionpack (= 6.0.4.1)
|
66
|
+
activejob (= 6.0.4.1)
|
67
|
+
activerecord (= 6.0.4.1)
|
68
|
+
marcel (~> 1.0.0)
|
69
|
+
activesupport (6.0.4.1)
|
70
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
71
|
+
i18n (>= 0.7, < 2)
|
72
|
+
minitest (~> 5.1)
|
73
|
+
tzinfo (~> 1.1)
|
74
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
75
|
+
appraisal (2.4.1)
|
76
|
+
bundler
|
77
|
+
rake
|
78
|
+
thor (>= 0.14.0)
|
79
|
+
builder (3.2.4)
|
80
|
+
concurrent-ruby (1.1.9)
|
81
|
+
crass (1.0.6)
|
82
|
+
diff-lcs (1.4.4)
|
83
|
+
erubi (1.10.0)
|
84
|
+
globalid (0.5.2)
|
85
|
+
activesupport (>= 5.0)
|
86
|
+
i18n (1.8.11)
|
87
|
+
concurrent-ruby (~> 1.0)
|
88
|
+
loofah (2.12.0)
|
89
|
+
crass (~> 1.0.2)
|
90
|
+
nokogiri (>= 1.5.9)
|
91
|
+
mail (2.7.1)
|
92
|
+
mini_mime (>= 0.1.1)
|
93
|
+
marcel (1.0.2)
|
94
|
+
method_source (1.0.0)
|
95
|
+
mini_mime (1.1.2)
|
96
|
+
minitest (5.14.4)
|
97
|
+
nilio (1.0.0)
|
98
|
+
nio4r (2.5.8)
|
99
|
+
nokogiri (1.12.5-x86_64-linux)
|
100
|
+
racc (~> 1.4)
|
101
|
+
racc (1.6.0)
|
102
|
+
rack (2.2.3)
|
103
|
+
rack-test (1.1.0)
|
104
|
+
rack (>= 1.0, < 3)
|
105
|
+
rails (6.0.4.1)
|
106
|
+
actioncable (= 6.0.4.1)
|
107
|
+
actionmailbox (= 6.0.4.1)
|
108
|
+
actionmailer (= 6.0.4.1)
|
109
|
+
actionpack (= 6.0.4.1)
|
110
|
+
actiontext (= 6.0.4.1)
|
111
|
+
actionview (= 6.0.4.1)
|
112
|
+
activejob (= 6.0.4.1)
|
113
|
+
activemodel (= 6.0.4.1)
|
114
|
+
activerecord (= 6.0.4.1)
|
115
|
+
activestorage (= 6.0.4.1)
|
116
|
+
activesupport (= 6.0.4.1)
|
117
|
+
bundler (>= 1.3.0)
|
118
|
+
railties (= 6.0.4.1)
|
119
|
+
sprockets-rails (>= 2.0.0)
|
120
|
+
rails-dom-testing (2.0.3)
|
121
|
+
activesupport (>= 4.2.0)
|
122
|
+
nokogiri (>= 1.6)
|
123
|
+
rails-html-sanitizer (1.4.2)
|
124
|
+
loofah (~> 2.3)
|
125
|
+
railties (6.0.4.1)
|
126
|
+
actionpack (= 6.0.4.1)
|
127
|
+
activesupport (= 6.0.4.1)
|
128
|
+
method_source
|
129
|
+
rake (>= 0.8.7)
|
130
|
+
thor (>= 0.20.3, < 2.0)
|
131
|
+
rake (13.0.6)
|
132
|
+
rspec (3.10.0)
|
133
|
+
rspec-core (~> 3.10.0)
|
134
|
+
rspec-expectations (~> 3.10.0)
|
135
|
+
rspec-mocks (~> 3.10.0)
|
136
|
+
rspec-core (3.10.1)
|
137
|
+
rspec-support (~> 3.10.0)
|
138
|
+
rspec-expectations (3.10.1)
|
139
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
140
|
+
rspec-support (~> 3.10.0)
|
141
|
+
rspec-mocks (3.10.2)
|
142
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
143
|
+
rspec-support (~> 3.10.0)
|
144
|
+
rspec-support (3.10.3)
|
145
|
+
sprockets (4.0.2)
|
146
|
+
concurrent-ruby (~> 1.0)
|
147
|
+
rack (> 1, < 3)
|
148
|
+
sprockets-rails (3.2.2)
|
149
|
+
actionpack (>= 4.0)
|
150
|
+
activesupport (>= 4.0)
|
151
|
+
sprockets (>= 3.0.0)
|
152
|
+
thor (1.1.0)
|
153
|
+
thread_safe (0.3.6)
|
154
|
+
tzinfo (1.2.9)
|
155
|
+
thread_safe (~> 0.1)
|
156
|
+
websocket-driver (0.7.5)
|
157
|
+
websocket-extensions (>= 0.1.0)
|
158
|
+
websocket-extensions (0.1.5)
|
159
|
+
zeitwerk (2.5.1)
|
160
|
+
|
161
|
+
PLATFORMS
|
162
|
+
ruby
|
163
|
+
|
164
|
+
DEPENDENCIES
|
165
|
+
appraisal
|
166
|
+
cached_resource!
|
167
|
+
rails (~> 6.0.0)
|
168
|
+
rake
|
169
|
+
rspec
|
170
|
+
|
171
|
+
BUNDLED WITH
|
172
|
+
1.17.3
|
@@ -0,0 +1,175 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
cached_resource (5.3.0)
|
5
|
+
activeresource (>= 4.0)
|
6
|
+
activesupport (>= 4.0)
|
7
|
+
nilio (>= 1.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
actioncable (6.1.4.1)
|
13
|
+
actionpack (= 6.1.4.1)
|
14
|
+
activesupport (= 6.1.4.1)
|
15
|
+
nio4r (~> 2.0)
|
16
|
+
websocket-driver (>= 0.6.1)
|
17
|
+
actionmailbox (6.1.4.1)
|
18
|
+
actionpack (= 6.1.4.1)
|
19
|
+
activejob (= 6.1.4.1)
|
20
|
+
activerecord (= 6.1.4.1)
|
21
|
+
activestorage (= 6.1.4.1)
|
22
|
+
activesupport (= 6.1.4.1)
|
23
|
+
mail (>= 2.7.1)
|
24
|
+
actionmailer (6.1.4.1)
|
25
|
+
actionpack (= 6.1.4.1)
|
26
|
+
actionview (= 6.1.4.1)
|
27
|
+
activejob (= 6.1.4.1)
|
28
|
+
activesupport (= 6.1.4.1)
|
29
|
+
mail (~> 2.5, >= 2.5.4)
|
30
|
+
rails-dom-testing (~> 2.0)
|
31
|
+
actionpack (6.1.4.1)
|
32
|
+
actionview (= 6.1.4.1)
|
33
|
+
activesupport (= 6.1.4.1)
|
34
|
+
rack (~> 2.0, >= 2.0.9)
|
35
|
+
rack-test (>= 0.6.3)
|
36
|
+
rails-dom-testing (~> 2.0)
|
37
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
38
|
+
actiontext (6.1.4.1)
|
39
|
+
actionpack (= 6.1.4.1)
|
40
|
+
activerecord (= 6.1.4.1)
|
41
|
+
activestorage (= 6.1.4.1)
|
42
|
+
activesupport (= 6.1.4.1)
|
43
|
+
nokogiri (>= 1.8.5)
|
44
|
+
actionview (6.1.4.1)
|
45
|
+
activesupport (= 6.1.4.1)
|
46
|
+
builder (~> 3.1)
|
47
|
+
erubi (~> 1.4)
|
48
|
+
rails-dom-testing (~> 2.0)
|
49
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
50
|
+
activejob (6.1.4.1)
|
51
|
+
activesupport (= 6.1.4.1)
|
52
|
+
globalid (>= 0.3.6)
|
53
|
+
activemodel (6.1.4.1)
|
54
|
+
activesupport (= 6.1.4.1)
|
55
|
+
activemodel-serializers-xml (1.0.2)
|
56
|
+
activemodel (> 5.x)
|
57
|
+
activesupport (> 5.x)
|
58
|
+
builder (~> 3.1)
|
59
|
+
activerecord (6.1.4.1)
|
60
|
+
activemodel (= 6.1.4.1)
|
61
|
+
activesupport (= 6.1.4.1)
|
62
|
+
activeresource (5.1.1)
|
63
|
+
activemodel (>= 5.0, < 7)
|
64
|
+
activemodel-serializers-xml (~> 1.0)
|
65
|
+
activesupport (>= 5.0, < 7)
|
66
|
+
activestorage (6.1.4.1)
|
67
|
+
actionpack (= 6.1.4.1)
|
68
|
+
activejob (= 6.1.4.1)
|
69
|
+
activerecord (= 6.1.4.1)
|
70
|
+
activesupport (= 6.1.4.1)
|
71
|
+
marcel (~> 1.0.0)
|
72
|
+
mini_mime (>= 1.1.0)
|
73
|
+
activesupport (6.1.4.1)
|
74
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
75
|
+
i18n (>= 1.6, < 2)
|
76
|
+
minitest (>= 5.1)
|
77
|
+
tzinfo (~> 2.0)
|
78
|
+
zeitwerk (~> 2.3)
|
79
|
+
appraisal (2.4.1)
|
80
|
+
bundler
|
81
|
+
rake
|
82
|
+
thor (>= 0.14.0)
|
83
|
+
builder (3.2.4)
|
84
|
+
concurrent-ruby (1.1.9)
|
85
|
+
crass (1.0.6)
|
86
|
+
diff-lcs (1.4.4)
|
87
|
+
erubi (1.10.0)
|
88
|
+
globalid (0.5.2)
|
89
|
+
activesupport (>= 5.0)
|
90
|
+
i18n (1.8.11)
|
91
|
+
concurrent-ruby (~> 1.0)
|
92
|
+
loofah (2.12.0)
|
93
|
+
crass (~> 1.0.2)
|
94
|
+
nokogiri (>= 1.5.9)
|
95
|
+
mail (2.7.1)
|
96
|
+
mini_mime (>= 0.1.1)
|
97
|
+
marcel (1.0.2)
|
98
|
+
method_source (1.0.0)
|
99
|
+
mini_mime (1.1.2)
|
100
|
+
minitest (5.14.4)
|
101
|
+
nilio (1.0.0)
|
102
|
+
nio4r (2.5.8)
|
103
|
+
nokogiri (1.12.5-x86_64-linux)
|
104
|
+
racc (~> 1.4)
|
105
|
+
racc (1.6.0)
|
106
|
+
rack (2.2.3)
|
107
|
+
rack-test (1.1.0)
|
108
|
+
rack (>= 1.0, < 3)
|
109
|
+
rails (6.1.4.1)
|
110
|
+
actioncable (= 6.1.4.1)
|
111
|
+
actionmailbox (= 6.1.4.1)
|
112
|
+
actionmailer (= 6.1.4.1)
|
113
|
+
actionpack (= 6.1.4.1)
|
114
|
+
actiontext (= 6.1.4.1)
|
115
|
+
actionview (= 6.1.4.1)
|
116
|
+
activejob (= 6.1.4.1)
|
117
|
+
activemodel (= 6.1.4.1)
|
118
|
+
activerecord (= 6.1.4.1)
|
119
|
+
activestorage (= 6.1.4.1)
|
120
|
+
activesupport (= 6.1.4.1)
|
121
|
+
bundler (>= 1.15.0)
|
122
|
+
railties (= 6.1.4.1)
|
123
|
+
sprockets-rails (>= 2.0.0)
|
124
|
+
rails-dom-testing (2.0.3)
|
125
|
+
activesupport (>= 4.2.0)
|
126
|
+
nokogiri (>= 1.6)
|
127
|
+
rails-html-sanitizer (1.4.2)
|
128
|
+
loofah (~> 2.3)
|
129
|
+
railties (6.1.4.1)
|
130
|
+
actionpack (= 6.1.4.1)
|
131
|
+
activesupport (= 6.1.4.1)
|
132
|
+
method_source
|
133
|
+
rake (>= 0.13)
|
134
|
+
thor (~> 1.0)
|
135
|
+
rake (13.0.6)
|
136
|
+
rspec (3.10.0)
|
137
|
+
rspec-core (~> 3.10.0)
|
138
|
+
rspec-expectations (~> 3.10.0)
|
139
|
+
rspec-mocks (~> 3.10.0)
|
140
|
+
rspec-core (3.10.1)
|
141
|
+
rspec-support (~> 3.10.0)
|
142
|
+
rspec-expectations (3.10.1)
|
143
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
144
|
+
rspec-support (~> 3.10.0)
|
145
|
+
rspec-mocks (3.10.2)
|
146
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
147
|
+
rspec-support (~> 3.10.0)
|
148
|
+
rspec-support (3.10.3)
|
149
|
+
sprockets (4.0.2)
|
150
|
+
concurrent-ruby (~> 1.0)
|
151
|
+
rack (> 1, < 3)
|
152
|
+
sprockets-rails (3.2.2)
|
153
|
+
actionpack (>= 4.0)
|
154
|
+
activesupport (>= 4.0)
|
155
|
+
sprockets (>= 3.0.0)
|
156
|
+
thor (1.1.0)
|
157
|
+
tzinfo (2.0.4)
|
158
|
+
concurrent-ruby (~> 1.0)
|
159
|
+
websocket-driver (0.7.5)
|
160
|
+
websocket-extensions (>= 0.1.0)
|
161
|
+
websocket-extensions (0.1.5)
|
162
|
+
zeitwerk (2.5.1)
|
163
|
+
|
164
|
+
PLATFORMS
|
165
|
+
ruby
|
166
|
+
|
167
|
+
DEPENDENCIES
|
168
|
+
appraisal
|
169
|
+
cached_resource!
|
170
|
+
rails (~> 6.1.0)
|
171
|
+
rake
|
172
|
+
rspec
|
173
|
+
|
174
|
+
BUNDLED WITH
|
175
|
+
1.17.3
|
@@ -0,0 +1,193 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
cached_resource (5.3.0)
|
5
|
+
activeresource (>= 4.0)
|
6
|
+
activesupport (>= 4.0)
|
7
|
+
nilio (>= 1.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: http://rubygems.org/
|
11
|
+
specs:
|
12
|
+
actioncable (7.0.4)
|
13
|
+
actionpack (= 7.0.4)
|
14
|
+
activesupport (= 7.0.4)
|
15
|
+
nio4r (~> 2.0)
|
16
|
+
websocket-driver (>= 0.6.1)
|
17
|
+
actionmailbox (7.0.4)
|
18
|
+
actionpack (= 7.0.4)
|
19
|
+
activejob (= 7.0.4)
|
20
|
+
activerecord (= 7.0.4)
|
21
|
+
activestorage (= 7.0.4)
|
22
|
+
activesupport (= 7.0.4)
|
23
|
+
mail (>= 2.7.1)
|
24
|
+
net-imap
|
25
|
+
net-pop
|
26
|
+
net-smtp
|
27
|
+
actionmailer (7.0.4)
|
28
|
+
actionpack (= 7.0.4)
|
29
|
+
actionview (= 7.0.4)
|
30
|
+
activejob (= 7.0.4)
|
31
|
+
activesupport (= 7.0.4)
|
32
|
+
mail (~> 2.5, >= 2.5.4)
|
33
|
+
net-imap
|
34
|
+
net-pop
|
35
|
+
net-smtp
|
36
|
+
rails-dom-testing (~> 2.0)
|
37
|
+
actionpack (7.0.4)
|
38
|
+
actionview (= 7.0.4)
|
39
|
+
activesupport (= 7.0.4)
|
40
|
+
rack (~> 2.0, >= 2.2.0)
|
41
|
+
rack-test (>= 0.6.3)
|
42
|
+
rails-dom-testing (~> 2.0)
|
43
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
44
|
+
actiontext (7.0.4)
|
45
|
+
actionpack (= 7.0.4)
|
46
|
+
activerecord (= 7.0.4)
|
47
|
+
activestorage (= 7.0.4)
|
48
|
+
activesupport (= 7.0.4)
|
49
|
+
globalid (>= 0.6.0)
|
50
|
+
nokogiri (>= 1.8.5)
|
51
|
+
actionview (7.0.4)
|
52
|
+
activesupport (= 7.0.4)
|
53
|
+
builder (~> 3.1)
|
54
|
+
erubi (~> 1.4)
|
55
|
+
rails-dom-testing (~> 2.0)
|
56
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
57
|
+
activejob (7.0.4)
|
58
|
+
activesupport (= 7.0.4)
|
59
|
+
globalid (>= 0.3.6)
|
60
|
+
activemodel (7.0.4)
|
61
|
+
activesupport (= 7.0.4)
|
62
|
+
activemodel-serializers-xml (1.0.2)
|
63
|
+
activemodel (> 5.x)
|
64
|
+
activesupport (> 5.x)
|
65
|
+
builder (~> 3.1)
|
66
|
+
activerecord (7.0.4)
|
67
|
+
activemodel (= 7.0.4)
|
68
|
+
activesupport (= 7.0.4)
|
69
|
+
activeresource (6.0.0)
|
70
|
+
activemodel (>= 6.0)
|
71
|
+
activemodel-serializers-xml (~> 1.0)
|
72
|
+
activesupport (>= 6.0)
|
73
|
+
activestorage (7.0.4)
|
74
|
+
actionpack (= 7.0.4)
|
75
|
+
activejob (= 7.0.4)
|
76
|
+
activerecord (= 7.0.4)
|
77
|
+
activesupport (= 7.0.4)
|
78
|
+
marcel (~> 1.0)
|
79
|
+
mini_mime (>= 1.1.0)
|
80
|
+
activesupport (7.0.4)
|
81
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
82
|
+
i18n (>= 1.6, < 2)
|
83
|
+
minitest (>= 5.1)
|
84
|
+
tzinfo (~> 2.0)
|
85
|
+
appraisal (2.4.1)
|
86
|
+
bundler
|
87
|
+
rake
|
88
|
+
thor (>= 0.14.0)
|
89
|
+
builder (3.2.4)
|
90
|
+
concurrent-ruby (1.1.10)
|
91
|
+
crass (1.0.6)
|
92
|
+
diff-lcs (1.5.0)
|
93
|
+
digest (3.1.0)
|
94
|
+
erubi (1.11.0)
|
95
|
+
globalid (1.0.0)
|
96
|
+
activesupport (>= 5.0)
|
97
|
+
i18n (1.12.0)
|
98
|
+
concurrent-ruby (~> 1.0)
|
99
|
+
loofah (2.19.0)
|
100
|
+
crass (~> 1.0.2)
|
101
|
+
nokogiri (>= 1.5.9)
|
102
|
+
mail (2.7.1)
|
103
|
+
mini_mime (>= 0.1.1)
|
104
|
+
marcel (1.0.2)
|
105
|
+
method_source (1.0.0)
|
106
|
+
mini_mime (1.1.2)
|
107
|
+
mini_portile2 (2.8.0)
|
108
|
+
minitest (5.16.3)
|
109
|
+
net-imap (0.2.3)
|
110
|
+
digest
|
111
|
+
net-protocol
|
112
|
+
strscan
|
113
|
+
net-pop (0.1.1)
|
114
|
+
digest
|
115
|
+
net-protocol
|
116
|
+
timeout
|
117
|
+
net-protocol (0.1.3)
|
118
|
+
timeout
|
119
|
+
net-smtp (0.3.1)
|
120
|
+
digest
|
121
|
+
net-protocol
|
122
|
+
timeout
|
123
|
+
nilio (1.0.0)
|
124
|
+
nio4r (2.5.8)
|
125
|
+
nokogiri (1.13.8)
|
126
|
+
mini_portile2 (~> 2.8.0)
|
127
|
+
racc (~> 1.4)
|
128
|
+
racc (1.6.0)
|
129
|
+
rack (2.2.4)
|
130
|
+
rack-test (2.0.2)
|
131
|
+
rack (>= 1.3)
|
132
|
+
rails (7.0.4)
|
133
|
+
actioncable (= 7.0.4)
|
134
|
+
actionmailbox (= 7.0.4)
|
135
|
+
actionmailer (= 7.0.4)
|
136
|
+
actionpack (= 7.0.4)
|
137
|
+
actiontext (= 7.0.4)
|
138
|
+
actionview (= 7.0.4)
|
139
|
+
activejob (= 7.0.4)
|
140
|
+
activemodel (= 7.0.4)
|
141
|
+
activerecord (= 7.0.4)
|
142
|
+
activestorage (= 7.0.4)
|
143
|
+
activesupport (= 7.0.4)
|
144
|
+
bundler (>= 1.15.0)
|
145
|
+
railties (= 7.0.4)
|
146
|
+
rails-dom-testing (2.0.3)
|
147
|
+
activesupport (>= 4.2.0)
|
148
|
+
nokogiri (>= 1.6)
|
149
|
+
rails-html-sanitizer (1.4.3)
|
150
|
+
loofah (~> 2.3)
|
151
|
+
railties (7.0.4)
|
152
|
+
actionpack (= 7.0.4)
|
153
|
+
activesupport (= 7.0.4)
|
154
|
+
method_source
|
155
|
+
rake (>= 12.2)
|
156
|
+
thor (~> 1.0)
|
157
|
+
zeitwerk (~> 2.5)
|
158
|
+
rake (13.0.6)
|
159
|
+
rspec (3.11.0)
|
160
|
+
rspec-core (~> 3.11.0)
|
161
|
+
rspec-expectations (~> 3.11.0)
|
162
|
+
rspec-mocks (~> 3.11.0)
|
163
|
+
rspec-core (3.11.0)
|
164
|
+
rspec-support (~> 3.11.0)
|
165
|
+
rspec-expectations (3.11.1)
|
166
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
167
|
+
rspec-support (~> 3.11.0)
|
168
|
+
rspec-mocks (3.11.1)
|
169
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
170
|
+
rspec-support (~> 3.11.0)
|
171
|
+
rspec-support (3.11.1)
|
172
|
+
strscan (3.0.4)
|
173
|
+
thor (1.2.1)
|
174
|
+
timeout (0.3.0)
|
175
|
+
tzinfo (2.0.5)
|
176
|
+
concurrent-ruby (~> 1.0)
|
177
|
+
websocket-driver (0.7.5)
|
178
|
+
websocket-extensions (>= 0.1.0)
|
179
|
+
websocket-extensions (0.1.5)
|
180
|
+
zeitwerk (2.6.0)
|
181
|
+
|
182
|
+
PLATFORMS
|
183
|
+
ruby
|
184
|
+
|
185
|
+
DEPENDENCIES
|
186
|
+
appraisal
|
187
|
+
cached_resource!
|
188
|
+
rails (~> 7.0.0)
|
189
|
+
rake
|
190
|
+
rspec
|
191
|
+
|
192
|
+
BUNDLED WITH
|
193
|
+
1.17.3
|
@@ -17,6 +17,7 @@ module CachedResource
|
|
17
17
|
def find_with_cache(*arguments)
|
18
18
|
arguments << {} unless arguments.last.is_a?(Hash)
|
19
19
|
should_reload = arguments.last.delete(:reload) || !cached_resource.enabled
|
20
|
+
should_reload = true if !cached_resource.cache_collections && is_any_collection?(*arguments)
|
20
21
|
arguments.pop if arguments.last.empty?
|
21
22
|
key = cache_key(arguments)
|
22
23
|
|
@@ -41,6 +42,7 @@ module CachedResource
|
|
41
42
|
def find_via_reload(key, *arguments)
|
42
43
|
object = find_without_cache(*arguments)
|
43
44
|
cache_collection_synchronize(object, *arguments) if cached_resource.collection_synchronize
|
45
|
+
return object if !cached_resource.cache_collections && is_any_collection?(*arguments)
|
44
46
|
cache_write(key, object)
|
45
47
|
cache_read(key)
|
46
48
|
end
|
@@ -82,6 +84,12 @@ module CachedResource
|
|
82
84
|
arguments == cached_resource.collection_arguments
|
83
85
|
end
|
84
86
|
|
87
|
+
# Determine if the given arguments represent
|
88
|
+
# any collection of objects
|
89
|
+
def is_any_collection?(*arguments)
|
90
|
+
cached_resource.collection_arguments.all?{ |arg| arguments.include?(arg) } || arguments.include?(:all)
|
91
|
+
end
|
92
|
+
|
85
93
|
# Read a entry from the cache for the given key.
|
86
94
|
def cache_read(key)
|
87
95
|
object = cached_resource.cache.read(key).try do |json_cache|
|
@@ -22,7 +22,8 @@ module CachedResource
|
|
22
22
|
# :collection_synchronize, default: false,
|
23
23
|
# :collection_arguments, default: [:all]
|
24
24
|
# :cache, default: Rails.cache or ActiveSupport::Cache::MemoryStore.new,
|
25
|
-
# :logger, default: Rails.logger or ActiveSupport::Logger.new(NilIO.new)
|
25
|
+
# :logger, default: Rails.logger or ActiveSupport::Logger.new(NilIO.new),
|
26
|
+
# :cache_collections, default: true
|
26
27
|
def initialize(options={})
|
27
28
|
super({
|
28
29
|
:enabled => true,
|
@@ -33,7 +34,8 @@ module CachedResource
|
|
33
34
|
:collection_synchronize => false,
|
34
35
|
:collection_arguments => [:all],
|
35
36
|
:cache => defined?(Rails.cache) && Rails.cache || CACHE,
|
36
|
-
:logger => defined?(Rails.logger) && Rails.logger || LOGGER
|
37
|
+
:logger => defined?(Rails.logger) && Rails.logger || LOGGER,
|
38
|
+
:cache_collections => true
|
37
39
|
}.merge(options))
|
38
40
|
end
|
39
41
|
|
@@ -24,7 +24,7 @@ describe CachedResource do
|
|
24
24
|
@thing3 = {:thing => {:id => 3, :name => "Stu"}}
|
25
25
|
@string_thing = {:thing => {:id => "fded", :name => "Lev"}}
|
26
26
|
@other_string_thing = {:thing => {:id => "fded", :name => "Lon"}}
|
27
|
-
@date_thing = {:thing => {:id => 4, :created_at =>
|
27
|
+
@date_thing = {:thing => {:id => 4, :created_at => DateTime.new(2020)}}
|
28
28
|
@thing_json = @thing.to_json
|
29
29
|
@other_thing_json = @other_thing.to_json
|
30
30
|
@string_thing_json = @string_thing.to_json
|
@@ -565,4 +565,37 @@ describe CachedResource do
|
|
565
565
|
new_result.name.should_not == old_result.name
|
566
566
|
end
|
567
567
|
end
|
568
|
+
|
569
|
+
describe "when cache_collections is disabled" do
|
570
|
+
before(:each) do
|
571
|
+
Thing.cached_resource.cache.clear
|
572
|
+
Thing.cached_resource.cache_collections = false
|
573
|
+
|
574
|
+
ActiveResource::HttpMock.reset!
|
575
|
+
ActiveResource::HttpMock.respond_to do |mock|
|
576
|
+
mock.get "/things.json", {}, [@thing[:thing],@string_thing[:thing]].to_json(:root => :thing)
|
577
|
+
mock.get "/things/1.json", {}, @thing_json
|
578
|
+
mock.get "/things/fded.json", {}, @string_thing_json
|
579
|
+
end
|
580
|
+
end
|
581
|
+
|
582
|
+
it "should cache a response" do
|
583
|
+
result = Thing.find(1)
|
584
|
+
read_from_cache("thing/1").should == result
|
585
|
+
end
|
586
|
+
|
587
|
+
it "should not remake a single request" do
|
588
|
+
result = Thing.find(1)
|
589
|
+
ActiveResource::HttpMock.requests.length.should == 1
|
590
|
+
result = Thing.find(1)
|
591
|
+
ActiveResource::HttpMock.requests.length.should == 1
|
592
|
+
end
|
593
|
+
|
594
|
+
it "should always remake the request for collections" do
|
595
|
+
Thing.all
|
596
|
+
ActiveResource::HttpMock.requests.length.should == 1
|
597
|
+
Thing.all
|
598
|
+
ActiveResource::HttpMock.requests.length.should == 2
|
599
|
+
end
|
600
|
+
end
|
568
601
|
end
|
@@ -22,6 +22,10 @@ describe "CachedResource::Configuration" do
|
|
22
22
|
configuration.collection_arguments.should == [:all]
|
23
23
|
end
|
24
24
|
|
25
|
+
it "should cache collections" do
|
26
|
+
configuration.cache_collections == true
|
27
|
+
end
|
28
|
+
|
25
29
|
describe "outside a Rails environment" do
|
26
30
|
it "should be logging to a buffered logger attached to a NilIO" do
|
27
31
|
configuration.logger.class.should == default_logger
|
@@ -72,7 +76,8 @@ describe "CachedResource::Configuration" do
|
|
72
76
|
:enabled => false,
|
73
77
|
:collection_synchronize => true,
|
74
78
|
:collection_arguments => [:every],
|
75
|
-
:custom => "irrelevant"
|
79
|
+
:custom => "irrelevant",
|
80
|
+
:cache_collections => true
|
76
81
|
end
|
77
82
|
end
|
78
83
|
|
@@ -90,6 +95,7 @@ describe "CachedResource::Configuration" do
|
|
90
95
|
cr.collection_synchronize.should == true
|
91
96
|
cr.collection_arguments.should == [:every]
|
92
97
|
cr.custom.should == "irrelevant"
|
98
|
+
cr.cache_collections.should == true
|
93
99
|
end
|
94
100
|
end
|
95
101
|
|
@@ -130,7 +136,8 @@ describe "CachedResource::Configuration" do
|
|
130
136
|
:enabled => false,
|
131
137
|
:collection_synchronize => true,
|
132
138
|
:collection_arguments => [:every],
|
133
|
-
:custom => "irrelevant"
|
139
|
+
:custom => "irrelevant",
|
140
|
+
:cache_collections => true
|
134
141
|
end
|
135
142
|
|
136
143
|
class Foo < Bar
|
@@ -158,7 +165,8 @@ describe "CachedResource::Configuration" do
|
|
158
165
|
:enabled => false,
|
159
166
|
:collection_synchronize => true,
|
160
167
|
:collection_arguments => [:every],
|
161
|
-
:custom => "irrelevant"
|
168
|
+
:custom => "irrelevant",
|
169
|
+
:cache_collections => true
|
162
170
|
end
|
163
171
|
|
164
172
|
class Foo < Bar
|
@@ -186,6 +194,7 @@ describe "CachedResource::Configuration" do
|
|
186
194
|
cr.custom.should == nil
|
187
195
|
cr.ttl_randomization.should == false
|
188
196
|
cr.ttl_randomization_scale.should == (1..2)
|
197
|
+
cr.cache_collections.should == true
|
189
198
|
expect(cr.race_condition_ttl).to eq(86400)
|
190
199
|
end
|
191
200
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cached_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Morgan Brown
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -115,6 +115,12 @@ files:
|
|
115
115
|
- gemfiles/5.0.gemfile.lock
|
116
116
|
- gemfiles/5.1.gemfile
|
117
117
|
- gemfiles/5.1.gemfile.lock
|
118
|
+
- gemfiles/6.0.gemfile
|
119
|
+
- gemfiles/6.0.gemfile.lock
|
120
|
+
- gemfiles/6.1.gemfile
|
121
|
+
- gemfiles/6.1.gemfile.lock
|
122
|
+
- gemfiles/7.0.gemfile
|
123
|
+
- gemfiles/7.0.gemfile.lock
|
118
124
|
- lib/cached_resource.rb
|
119
125
|
- lib/cached_resource/cached_resource.rb
|
120
126
|
- lib/cached_resource/caching.rb
|
@@ -143,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
149
|
- !ruby/object:Gem::Version
|
144
150
|
version: '0'
|
145
151
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
152
|
+
rubygems_version: 3.1.6
|
147
153
|
signing_key:
|
148
154
|
specification_version: 4
|
149
155
|
summary: Caching for ActiveResource
|