level2 0.2.6 → 0.3.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 +8 -1
- data/Appraisals +11 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +29 -31
- data/README.md +5 -1
- data/appraise +28 -0
- data/gemfiles/rails_3.gemfile +13 -0
- data/gemfiles/rails_3.gemfile.lock +86 -0
- data/gemfiles/rails_4.gemfile +13 -0
- data/gemfiles/rails_4.gemfile.lock +91 -0
- data/gemfiles/rails_5.gemfile +13 -0
- data/gemfiles/rails_5.gemfile.lock +92 -0
- data/level2.gemspec +1 -9
- data/lib/active_support/cache/level2.rb +40 -23
- metadata +12 -88
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9faa709933e484f6a721424664ae888e651b6c1a
|
4
|
+
data.tar.gz: ca14851bfab45f3e3492d27ec6c88db1d5f3dc5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 233b35c61949ae2cfb1d2b4717628a5ea6a8057efdbb147482946e1a5ae6e5f81fc56d9b0b0b3a8fcaffe7f503e6e23d43491ade1885ddfc27a82527754cdb1c
|
7
|
+
data.tar.gz: 98d390da426fc05152914359986730c7ba263ea6f4f3f13e990b47b28d42b846de5c0e298bc90e2bf3529001749b9658af34099b52d34785c55547d3e74d6d4b
|
data/.travis.yml
CHANGED
data/Appraisals
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
level2 (0.
|
5
|
-
activesupport (~> 4)
|
4
|
+
level2 (0.3.0)
|
6
5
|
|
7
6
|
GEM
|
8
7
|
remote: https://rubygems.org/
|
9
8
|
specs:
|
10
|
-
activesupport (
|
11
|
-
i18n (~> 0.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
activesupport (3.2.22.5)
|
10
|
+
i18n (~> 0.6, >= 0.6.4)
|
11
|
+
multi_json (~> 1.0)
|
12
|
+
appraisal (2.1.0)
|
13
|
+
bundler
|
14
|
+
rake
|
15
|
+
thor (>= 0.14.0)
|
16
16
|
coderay (1.1.1)
|
17
|
-
diff-lcs (1.
|
18
|
-
ffi (1.9.
|
17
|
+
diff-lcs (1.3)
|
18
|
+
ffi (1.9.18)
|
19
19
|
formatador (0.2.5)
|
20
|
-
guard (2.14.
|
20
|
+
guard (2.14.1)
|
21
21
|
formatador (>= 0.2.4)
|
22
22
|
listen (>= 2.7, < 4.0)
|
23
23
|
lumberjack (~> 1.0)
|
@@ -27,36 +27,35 @@ GEM
|
|
27
27
|
shellany (~> 0.0)
|
28
28
|
thor (>= 0.18.1)
|
29
29
|
guard-compat (1.2.1)
|
30
|
-
guard-rspec (4.7.
|
30
|
+
guard-rspec (4.7.3)
|
31
31
|
guard (~> 2.1)
|
32
32
|
guard-compat (~> 1.1)
|
33
33
|
rspec (>= 2.99.0, < 4.0)
|
34
|
-
i18n (0.
|
35
|
-
json (1.8.3)
|
34
|
+
i18n (0.8.1)
|
36
35
|
listen (3.1.5)
|
37
36
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
38
37
|
rb-inotify (~> 0.9, >= 0.9.7)
|
39
38
|
ruby_dep (~> 1.2)
|
40
|
-
lumberjack (1.0.
|
39
|
+
lumberjack (1.0.11)
|
41
40
|
method_source (0.8.2)
|
42
|
-
|
41
|
+
multi_json (1.12.1)
|
43
42
|
nenv (0.3.0)
|
44
|
-
notiffany (0.1.
|
43
|
+
notiffany (0.1.1)
|
45
44
|
nenv (~> 0.1)
|
46
45
|
shellany (~> 0.0)
|
47
|
-
pry (0.10.
|
46
|
+
pry (0.10.4)
|
48
47
|
coderay (~> 1.1.0)
|
49
48
|
method_source (~> 0.8.1)
|
50
49
|
slop (~> 3.4)
|
51
|
-
rake (
|
52
|
-
rb-fsevent (0.9.
|
53
|
-
rb-inotify (0.9.
|
50
|
+
rake (12.0.0)
|
51
|
+
rb-fsevent (0.9.8)
|
52
|
+
rb-inotify (0.9.8)
|
54
53
|
ffi (>= 0.5.0)
|
55
54
|
rspec (3.5.0)
|
56
55
|
rspec-core (~> 3.5.0)
|
57
56
|
rspec-expectations (~> 3.5.0)
|
58
57
|
rspec-mocks (~> 3.5.0)
|
59
|
-
rspec-core (3.5.
|
58
|
+
rspec-core (3.5.4)
|
60
59
|
rspec-support (~> 3.5.0)
|
61
60
|
rspec-expectations (3.5.0)
|
62
61
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -65,24 +64,23 @@ GEM
|
|
65
64
|
diff-lcs (>= 1.2.0, < 2.0)
|
66
65
|
rspec-support (~> 3.5.0)
|
67
66
|
rspec-support (3.5.0)
|
68
|
-
ruby_dep (1.
|
67
|
+
ruby_dep (1.5.0)
|
69
68
|
shellany (0.0.1)
|
70
69
|
slop (3.6.0)
|
71
|
-
thor (0.19.
|
72
|
-
thread_safe (0.3.5)
|
73
|
-
tzinfo (1.2.2)
|
74
|
-
thread_safe (~> 0.1)
|
70
|
+
thor (0.19.4)
|
75
71
|
|
76
72
|
PLATFORMS
|
77
73
|
ruby
|
78
74
|
|
79
75
|
DEPENDENCIES
|
80
|
-
|
76
|
+
activesupport (~> 3)
|
77
|
+
appraisal
|
78
|
+
bundler
|
81
79
|
guard-rspec
|
82
80
|
level2!
|
83
81
|
pry
|
84
|
-
rake
|
85
|
-
rspec
|
82
|
+
rake
|
83
|
+
rspec
|
86
84
|
|
87
85
|
BUNDLED WITH
|
88
|
-
1.
|
86
|
+
1.14.6
|
data/README.md
CHANGED
@@ -15,6 +15,10 @@ or
|
|
15
15
|
[`redis_store`](https://github.com/redis-store/redis-store/wiki/Frameworks-Configuration)
|
16
16
|
as the second.
|
17
17
|
|
18
|
+
If your production setup has multiple Ruby processes per server, and some free
|
19
|
+
memory on servers, it can be more sensible to run one `mem_cache_store` per
|
20
|
+
server plus a shared one.
|
21
|
+
|
18
22
|
## Behaviour
|
19
23
|
|
20
24
|
- When reading a cache key, try reading from the first level first, then go down
|
@@ -60,7 +64,7 @@ From thereon,
|
|
60
64
|
|
61
65
|
- `Rails.cache.read` and `.fetch` will read from `L1` and fall back to `L2` if
|
62
66
|
the key is absent from `L1`.
|
63
|
-
|
67
|
+
- On L1 misses and L2 hits, L1 will be populated.
|
64
68
|
- `Rails.cache.write` and `.fetch` will write to both stores.
|
65
69
|
|
66
70
|
While discouraged, it is possible to write directly to a given cache level:
|
data/appraise
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Run all appraisals, with all specified rubies
|
4
|
+
#
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
|
8
|
+
RUBIES = YAML.load_file('.travis.yml')['rvm']
|
9
|
+
APPRAISALS = `appraisal list`.strip.split(/\s+/)
|
10
|
+
|
11
|
+
# setup
|
12
|
+
RUBIES.each do |ruby|
|
13
|
+
ENV['RBENV_VERSION'] = ruby
|
14
|
+
system 'rbenv version'
|
15
|
+
system 'rbenv exec ruby -v'
|
16
|
+
system 'rbenv exec bundle check || rbenv exec bundle install'
|
17
|
+
system "rbenv exec appraisal install"
|
18
|
+
end
|
19
|
+
|
20
|
+
# tests
|
21
|
+
RUBIES.each do |ruby|
|
22
|
+
ENV['RBENV_VERSION'] = ruby
|
23
|
+
system 'rbenv exec ruby -v'
|
24
|
+
APPRAISALS.each do |variant|
|
25
|
+
puts "*** Ruby #{ruby} / variant #{variant}"
|
26
|
+
system "rbenv exec appraisal #{variant} rspec"
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
level2 (0.3.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activesupport (3.2.22.5)
|
10
|
+
i18n (~> 0.6, >= 0.6.4)
|
11
|
+
multi_json (~> 1.0)
|
12
|
+
appraisal (2.1.0)
|
13
|
+
bundler
|
14
|
+
rake
|
15
|
+
thor (>= 0.14.0)
|
16
|
+
coderay (1.1.1)
|
17
|
+
diff-lcs (1.3)
|
18
|
+
ffi (1.9.18)
|
19
|
+
formatador (0.2.5)
|
20
|
+
guard (2.14.1)
|
21
|
+
formatador (>= 0.2.4)
|
22
|
+
listen (>= 2.7, < 4.0)
|
23
|
+
lumberjack (~> 1.0)
|
24
|
+
nenv (~> 0.1)
|
25
|
+
notiffany (~> 0.0)
|
26
|
+
pry (>= 0.9.12)
|
27
|
+
shellany (~> 0.0)
|
28
|
+
thor (>= 0.18.1)
|
29
|
+
guard-compat (1.2.1)
|
30
|
+
guard-rspec (4.7.3)
|
31
|
+
guard (~> 2.1)
|
32
|
+
guard-compat (~> 1.1)
|
33
|
+
rspec (>= 2.99.0, < 4.0)
|
34
|
+
i18n (0.8.1)
|
35
|
+
listen (3.1.5)
|
36
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
37
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
38
|
+
ruby_dep (~> 1.2)
|
39
|
+
lumberjack (1.0.11)
|
40
|
+
method_source (0.8.2)
|
41
|
+
multi_json (1.12.1)
|
42
|
+
nenv (0.3.0)
|
43
|
+
notiffany (0.1.1)
|
44
|
+
nenv (~> 0.1)
|
45
|
+
shellany (~> 0.0)
|
46
|
+
pry (0.10.4)
|
47
|
+
coderay (~> 1.1.0)
|
48
|
+
method_source (~> 0.8.1)
|
49
|
+
slop (~> 3.4)
|
50
|
+
rake (12.0.0)
|
51
|
+
rb-fsevent (0.9.8)
|
52
|
+
rb-inotify (0.9.8)
|
53
|
+
ffi (>= 0.5.0)
|
54
|
+
rspec (3.5.0)
|
55
|
+
rspec-core (~> 3.5.0)
|
56
|
+
rspec-expectations (~> 3.5.0)
|
57
|
+
rspec-mocks (~> 3.5.0)
|
58
|
+
rspec-core (3.5.4)
|
59
|
+
rspec-support (~> 3.5.0)
|
60
|
+
rspec-expectations (3.5.0)
|
61
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
62
|
+
rspec-support (~> 3.5.0)
|
63
|
+
rspec-mocks (3.5.0)
|
64
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
65
|
+
rspec-support (~> 3.5.0)
|
66
|
+
rspec-support (3.5.0)
|
67
|
+
ruby_dep (1.5.0)
|
68
|
+
shellany (0.0.1)
|
69
|
+
slop (3.6.0)
|
70
|
+
thor (0.19.4)
|
71
|
+
|
72
|
+
PLATFORMS
|
73
|
+
ruby
|
74
|
+
|
75
|
+
DEPENDENCIES
|
76
|
+
activesupport (~> 3)
|
77
|
+
appraisal
|
78
|
+
bundler
|
79
|
+
guard-rspec
|
80
|
+
level2!
|
81
|
+
pry
|
82
|
+
rake
|
83
|
+
rspec
|
84
|
+
|
85
|
+
BUNDLED WITH
|
86
|
+
1.14.6
|
@@ -0,0 +1,91 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
level2 (0.3.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activesupport (4.2.8)
|
10
|
+
i18n (~> 0.7)
|
11
|
+
minitest (~> 5.1)
|
12
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
13
|
+
tzinfo (~> 1.1)
|
14
|
+
appraisal (2.1.0)
|
15
|
+
bundler
|
16
|
+
rake
|
17
|
+
thor (>= 0.14.0)
|
18
|
+
coderay (1.1.1)
|
19
|
+
diff-lcs (1.3)
|
20
|
+
ffi (1.9.18)
|
21
|
+
formatador (0.2.5)
|
22
|
+
guard (2.14.1)
|
23
|
+
formatador (>= 0.2.4)
|
24
|
+
listen (>= 2.7, < 4.0)
|
25
|
+
lumberjack (~> 1.0)
|
26
|
+
nenv (~> 0.1)
|
27
|
+
notiffany (~> 0.0)
|
28
|
+
pry (>= 0.9.12)
|
29
|
+
shellany (~> 0.0)
|
30
|
+
thor (>= 0.18.1)
|
31
|
+
guard-compat (1.2.1)
|
32
|
+
guard-rspec (4.7.3)
|
33
|
+
guard (~> 2.1)
|
34
|
+
guard-compat (~> 1.1)
|
35
|
+
rspec (>= 2.99.0, < 4.0)
|
36
|
+
i18n (0.8.1)
|
37
|
+
listen (3.1.5)
|
38
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
39
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
40
|
+
ruby_dep (~> 1.2)
|
41
|
+
lumberjack (1.0.11)
|
42
|
+
method_source (0.8.2)
|
43
|
+
minitest (5.10.1)
|
44
|
+
nenv (0.3.0)
|
45
|
+
notiffany (0.1.1)
|
46
|
+
nenv (~> 0.1)
|
47
|
+
shellany (~> 0.0)
|
48
|
+
pry (0.10.4)
|
49
|
+
coderay (~> 1.1.0)
|
50
|
+
method_source (~> 0.8.1)
|
51
|
+
slop (~> 3.4)
|
52
|
+
rake (12.0.0)
|
53
|
+
rb-fsevent (0.9.8)
|
54
|
+
rb-inotify (0.9.8)
|
55
|
+
ffi (>= 0.5.0)
|
56
|
+
rspec (3.5.0)
|
57
|
+
rspec-core (~> 3.5.0)
|
58
|
+
rspec-expectations (~> 3.5.0)
|
59
|
+
rspec-mocks (~> 3.5.0)
|
60
|
+
rspec-core (3.5.4)
|
61
|
+
rspec-support (~> 3.5.0)
|
62
|
+
rspec-expectations (3.5.0)
|
63
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
64
|
+
rspec-support (~> 3.5.0)
|
65
|
+
rspec-mocks (3.5.0)
|
66
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
+
rspec-support (~> 3.5.0)
|
68
|
+
rspec-support (3.5.0)
|
69
|
+
ruby_dep (1.5.0)
|
70
|
+
shellany (0.0.1)
|
71
|
+
slop (3.6.0)
|
72
|
+
thor (0.19.4)
|
73
|
+
thread_safe (0.3.6)
|
74
|
+
tzinfo (1.2.3)
|
75
|
+
thread_safe (~> 0.1)
|
76
|
+
|
77
|
+
PLATFORMS
|
78
|
+
ruby
|
79
|
+
|
80
|
+
DEPENDENCIES
|
81
|
+
activesupport (~> 4)
|
82
|
+
appraisal
|
83
|
+
bundler
|
84
|
+
guard-rspec
|
85
|
+
level2!
|
86
|
+
pry
|
87
|
+
rake
|
88
|
+
rspec
|
89
|
+
|
90
|
+
BUNDLED WITH
|
91
|
+
1.14.6
|
@@ -0,0 +1,92 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
level2 (0.3.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activesupport (5.0.2)
|
10
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
11
|
+
i18n (~> 0.7)
|
12
|
+
minitest (~> 5.1)
|
13
|
+
tzinfo (~> 1.1)
|
14
|
+
appraisal (2.1.0)
|
15
|
+
bundler
|
16
|
+
rake
|
17
|
+
thor (>= 0.14.0)
|
18
|
+
coderay (1.1.1)
|
19
|
+
concurrent-ruby (1.0.5)
|
20
|
+
diff-lcs (1.3)
|
21
|
+
ffi (1.9.18)
|
22
|
+
formatador (0.2.5)
|
23
|
+
guard (2.14.1)
|
24
|
+
formatador (>= 0.2.4)
|
25
|
+
listen (>= 2.7, < 4.0)
|
26
|
+
lumberjack (~> 1.0)
|
27
|
+
nenv (~> 0.1)
|
28
|
+
notiffany (~> 0.0)
|
29
|
+
pry (>= 0.9.12)
|
30
|
+
shellany (~> 0.0)
|
31
|
+
thor (>= 0.18.1)
|
32
|
+
guard-compat (1.2.1)
|
33
|
+
guard-rspec (4.7.3)
|
34
|
+
guard (~> 2.1)
|
35
|
+
guard-compat (~> 1.1)
|
36
|
+
rspec (>= 2.99.0, < 4.0)
|
37
|
+
i18n (0.8.1)
|
38
|
+
listen (3.1.5)
|
39
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
40
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
41
|
+
ruby_dep (~> 1.2)
|
42
|
+
lumberjack (1.0.11)
|
43
|
+
method_source (0.8.2)
|
44
|
+
minitest (5.10.1)
|
45
|
+
nenv (0.3.0)
|
46
|
+
notiffany (0.1.1)
|
47
|
+
nenv (~> 0.1)
|
48
|
+
shellany (~> 0.0)
|
49
|
+
pry (0.10.4)
|
50
|
+
coderay (~> 1.1.0)
|
51
|
+
method_source (~> 0.8.1)
|
52
|
+
slop (~> 3.4)
|
53
|
+
rake (12.0.0)
|
54
|
+
rb-fsevent (0.9.8)
|
55
|
+
rb-inotify (0.9.8)
|
56
|
+
ffi (>= 0.5.0)
|
57
|
+
rspec (3.5.0)
|
58
|
+
rspec-core (~> 3.5.0)
|
59
|
+
rspec-expectations (~> 3.5.0)
|
60
|
+
rspec-mocks (~> 3.5.0)
|
61
|
+
rspec-core (3.5.4)
|
62
|
+
rspec-support (~> 3.5.0)
|
63
|
+
rspec-expectations (3.5.0)
|
64
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
65
|
+
rspec-support (~> 3.5.0)
|
66
|
+
rspec-mocks (3.5.0)
|
67
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
+
rspec-support (~> 3.5.0)
|
69
|
+
rspec-support (3.5.0)
|
70
|
+
ruby_dep (1.5.0)
|
71
|
+
shellany (0.0.1)
|
72
|
+
slop (3.6.0)
|
73
|
+
thor (0.19.4)
|
74
|
+
thread_safe (0.3.6)
|
75
|
+
tzinfo (1.2.3)
|
76
|
+
thread_safe (~> 0.1)
|
77
|
+
|
78
|
+
PLATFORMS
|
79
|
+
ruby
|
80
|
+
|
81
|
+
DEPENDENCIES
|
82
|
+
activesupport (~> 5)
|
83
|
+
appraisal
|
84
|
+
bundler
|
85
|
+
guard-rspec
|
86
|
+
level2!
|
87
|
+
pry
|
88
|
+
rake
|
89
|
+
rspec
|
90
|
+
|
91
|
+
BUNDLED WITH
|
92
|
+
1.14.6
|
data/level2.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'level2'
|
7
|
-
spec.version = '0.
|
7
|
+
spec.version = '0.3.0'
|
8
8
|
spec.authors = ['Julien Letessier']
|
9
9
|
spec.email = ['julien.letessier@gmail.com']
|
10
10
|
|
@@ -16,12 +16,4 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.bindir = 'exe'
|
17
17
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
18
|
spec.require_paths = ['lib']
|
19
|
-
|
20
|
-
spec.add_development_dependency 'bundler', '~> 1.12'
|
21
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
22
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
23
|
-
spec.add_development_dependency 'guard-rspec'
|
24
|
-
spec.add_development_dependency 'pry'
|
25
|
-
|
26
|
-
spec.add_runtime_dependency 'activesupport', '~> 4'
|
27
19
|
end
|
@@ -1,12 +1,17 @@
|
|
1
1
|
require 'active_support/cache'
|
2
2
|
|
3
|
+
require 'active_support/version'
|
4
|
+
if ActiveSupport::VERSION::MAJOR == 3
|
5
|
+
# active_support/cache actually depends on this but doesn't require it:
|
6
|
+
require 'securerandom'
|
7
|
+
end
|
8
|
+
|
3
9
|
module ActiveSupport
|
4
10
|
module Cache
|
5
11
|
class Level2 < Store
|
6
12
|
attr_reader :stores
|
7
13
|
|
8
14
|
def initialize(store_options)
|
9
|
-
@lock = Mutex.new
|
10
15
|
@stores = store_options.each_with_object({}) do |(name,options), h|
|
11
16
|
h[name] = ActiveSupport::Cache.lookup_store(options)
|
12
17
|
end
|
@@ -14,15 +19,26 @@ module ActiveSupport
|
|
14
19
|
end
|
15
20
|
|
16
21
|
def cleanup(*args)
|
17
|
-
@
|
18
|
-
@stores.each_value { |s| s.cleanup(*args) }
|
19
|
-
end
|
22
|
+
@stores.each_value { |s| s.cleanup(*args) }
|
20
23
|
end
|
21
24
|
|
22
25
|
def clear(*args)
|
23
|
-
@
|
24
|
-
|
26
|
+
@stores.each_value { |s| s.clear(*args) }
|
27
|
+
end
|
28
|
+
|
29
|
+
def read_multi(*names)
|
30
|
+
result = {}
|
31
|
+
@stores.each do |_name,store|
|
32
|
+
data = store.read_multi(*names)
|
33
|
+
result.merge! data
|
34
|
+
names -= data.keys
|
25
35
|
end
|
36
|
+
result
|
37
|
+
end
|
38
|
+
|
39
|
+
# Rails 3 doesn't instrument by default, this overrides it
|
40
|
+
def self.instrument
|
41
|
+
true
|
26
42
|
end
|
27
43
|
|
28
44
|
protected
|
@@ -37,29 +53,22 @@ module ActiveSupport
|
|
37
53
|
|
38
54
|
def read_entry(key, options)
|
39
55
|
stores = selected_stores(options)
|
40
|
-
|
41
|
-
read_entry_from(stores, key, options)
|
42
|
-
end
|
56
|
+
read_entry_from(stores, key, options)
|
43
57
|
end
|
44
58
|
|
45
59
|
def write_entry(key, entry, options)
|
46
60
|
stores = selected_stores(options)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
return false unless result
|
51
|
-
end
|
52
|
-
true
|
61
|
+
stores.each do |name, store|
|
62
|
+
result = store.send :write_entry, key, entry, options
|
63
|
+
return false unless result
|
53
64
|
end
|
54
65
|
end
|
55
66
|
|
56
67
|
def delete_entry(key, options)
|
57
68
|
selected_stores(options)
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
}.all?
|
62
|
-
end
|
69
|
+
stores.map { |name,store|
|
70
|
+
store.send :delete_entry, key, options
|
71
|
+
}.all?
|
63
72
|
end
|
64
73
|
|
65
74
|
private
|
@@ -81,7 +90,10 @@ module ActiveSupport
|
|
81
90
|
return entry if entry.present?
|
82
91
|
|
83
92
|
entry = read_entry_from(other_stores, key, options)
|
84
|
-
|
93
|
+
unless entry.present?
|
94
|
+
current_level! :all
|
95
|
+
return
|
96
|
+
end
|
85
97
|
store.send :write_entry, key, entry, {}
|
86
98
|
|
87
99
|
entry
|
@@ -89,8 +101,13 @@ module ActiveSupport
|
|
89
101
|
|
90
102
|
def selected_stores(options)
|
91
103
|
only = options[:only]
|
92
|
-
|
93
|
-
|
104
|
+
if only.nil?
|
105
|
+
current_level! :all
|
106
|
+
@stores
|
107
|
+
else
|
108
|
+
current_level! only
|
109
|
+
@stores.select { |name,_| name == only }
|
110
|
+
end
|
94
111
|
end
|
95
112
|
|
96
113
|
end
|
metadata
CHANGED
@@ -1,99 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: level2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Letessier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.12'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.12'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: guard-rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: pry
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: activesupport
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '4'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '4'
|
11
|
+
date: 2017-04-05 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
97
13
|
description:
|
98
14
|
email:
|
99
15
|
- julien.letessier@gmail.com
|
@@ -104,14 +20,22 @@ files:
|
|
104
20
|
- ".gitignore"
|
105
21
|
- ".rspec"
|
106
22
|
- ".travis.yml"
|
23
|
+
- Appraisals
|
107
24
|
- Gemfile
|
108
25
|
- Gemfile.lock
|
109
26
|
- Guardfile
|
110
27
|
- LICENSE.txt
|
111
28
|
- README.md
|
112
29
|
- Rakefile
|
30
|
+
- appraise
|
113
31
|
- bin/console
|
114
32
|
- bin/setup
|
33
|
+
- gemfiles/rails_3.gemfile
|
34
|
+
- gemfiles/rails_3.gemfile.lock
|
35
|
+
- gemfiles/rails_4.gemfile
|
36
|
+
- gemfiles/rails_4.gemfile.lock
|
37
|
+
- gemfiles/rails_5.gemfile
|
38
|
+
- gemfiles/rails_5.gemfile.lock
|
115
39
|
- level2.gemspec
|
116
40
|
- lib/active_support/cache/level2.rb
|
117
41
|
- lib/level2.rb
|
@@ -135,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
59
|
version: '0'
|
136
60
|
requirements: []
|
137
61
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.5.
|
62
|
+
rubygems_version: 2.5.2
|
139
63
|
signing_key:
|
140
64
|
specification_version: 4
|
141
65
|
summary: Multiple caching levels for Rails. Kinda like your CPU's L1/L2 caches.
|