activesupport_cache_database 0.2.1 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +6 -3
- data/.rubocop.yml +1 -1
- data/Gemfile +7 -0
- data/Gemfile.lock +54 -50
- data/Gemfile.rails6 +11 -0
- data/Gemfile.rails6.lock +101 -0
- data/activesupport_cache_database.gemspec +5 -11
- metadata +13 -98
- data/spec/active_support/cache/database_store_spec.rb +0 -329
- data/spec/spec_helper.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57713e86691e63aafba7d0a6058f46add905cd0087dfe8e1b10213171903c246
|
4
|
+
data.tar.gz: ef982713ee31115a33e51d493e83df54b2a949142f023e4fcacf7d8cc8435db4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a9e2192dd884334ec69ee1fcd418193c8a2499156dc553f18d9c7a6ea3d92fc6862f33a4d391eacc10ce4ae598aec4148a154f22b12f02018a00a2408a9aaef
|
7
|
+
data.tar.gz: e28a4b456bc68804bbb247a6dfc3159bdaf2ea31a1ba67685c6dcf1e1d012d948029b6de23821015d38ca49d6e15ad0144e0912a159bc66db29c3aa01d0ec6fa
|
data/.github/workflows/test.yml
CHANGED
@@ -7,13 +7,16 @@ on:
|
|
7
7
|
branches: [main]
|
8
8
|
|
9
9
|
jobs:
|
10
|
-
|
10
|
+
test:
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
strategy:
|
13
13
|
matrix:
|
14
|
-
ruby-version: ["2.
|
14
|
+
ruby-version: ["2.7", "3.0", "3.1", "3.2"]
|
15
|
+
gemfiles: ["Gemfile", "Gemfile.rails6"]
|
16
|
+
env:
|
17
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
15
18
|
steps:
|
16
|
-
- uses: actions/checkout@
|
19
|
+
- uses: actions/checkout@v3
|
17
20
|
- uses: ruby/setup-ruby@v1
|
18
21
|
with:
|
19
22
|
ruby-version: ${{ matrix.ruby-version }}
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,82 +1,86 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activesupport_cache_database (0.
|
5
|
-
activerecord (>=
|
6
|
-
activesupport (>=
|
4
|
+
activesupport_cache_database (0.3.1)
|
5
|
+
activerecord (>= 6.0)
|
6
|
+
activesupport (>= 6.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (
|
12
|
-
activesupport (=
|
13
|
-
activerecord (
|
14
|
-
activemodel (=
|
15
|
-
activesupport (=
|
16
|
-
activesupport (
|
11
|
+
activemodel (7.0.4.2)
|
12
|
+
activesupport (= 7.0.4.2)
|
13
|
+
activerecord (7.0.4.2)
|
14
|
+
activemodel (= 7.0.4.2)
|
15
|
+
activesupport (= 7.0.4.2)
|
16
|
+
activesupport (7.0.4.2)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
18
|
i18n (>= 1.6, < 2)
|
19
19
|
minitest (>= 5.1)
|
20
20
|
tzinfo (~> 2.0)
|
21
|
-
zeitwerk (~> 2.3)
|
22
21
|
ast (2.4.2)
|
23
|
-
concurrent-ruby (1.
|
24
|
-
diff-lcs (1.
|
25
|
-
i18n (1.
|
22
|
+
concurrent-ruby (1.2.0)
|
23
|
+
diff-lcs (1.5.0)
|
24
|
+
i18n (1.12.0)
|
26
25
|
concurrent-ruby (~> 1.0)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
26
|
+
json (2.6.3)
|
27
|
+
mini_portile2 (2.8.1)
|
28
|
+
minitest (5.17.0)
|
29
|
+
mysql2 (0.5.5)
|
30
|
+
parallel (1.22.1)
|
31
|
+
parser (3.2.0.0)
|
31
32
|
ast (~> 2.4.1)
|
32
|
-
pg (1.
|
33
|
-
rainbow (3.
|
34
|
-
rake (13.0.
|
35
|
-
regexp_parser (2.
|
33
|
+
pg (1.4.5)
|
34
|
+
rainbow (3.1.1)
|
35
|
+
rake (13.0.6)
|
36
|
+
regexp_parser (2.6.2)
|
36
37
|
rexml (3.2.5)
|
37
|
-
rspec (3.
|
38
|
-
rspec-core (~> 3.
|
39
|
-
rspec-expectations (~> 3.
|
40
|
-
rspec-mocks (~> 3.
|
41
|
-
rspec-core (3.
|
42
|
-
rspec-support (~> 3.
|
43
|
-
rspec-expectations (3.
|
38
|
+
rspec (3.12.0)
|
39
|
+
rspec-core (~> 3.12.0)
|
40
|
+
rspec-expectations (~> 3.12.0)
|
41
|
+
rspec-mocks (~> 3.12.0)
|
42
|
+
rspec-core (3.12.0)
|
43
|
+
rspec-support (~> 3.12.0)
|
44
|
+
rspec-expectations (3.12.2)
|
44
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.
|
46
|
-
rspec-mocks (3.
|
46
|
+
rspec-support (~> 3.12.0)
|
47
|
+
rspec-mocks (3.12.3)
|
47
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
-
rspec-support (~> 3.
|
49
|
-
rspec-support (3.
|
50
|
-
rubocop (1.
|
49
|
+
rspec-support (~> 3.12.0)
|
50
|
+
rspec-support (3.12.0)
|
51
|
+
rubocop (1.44.1)
|
52
|
+
json (~> 2.3)
|
51
53
|
parallel (~> 1.10)
|
52
|
-
parser (>= 3.
|
54
|
+
parser (>= 3.2.0.0)
|
53
55
|
rainbow (>= 2.2.2, < 4.0)
|
54
56
|
regexp_parser (>= 1.8, < 3.0)
|
55
|
-
rexml
|
56
|
-
rubocop-ast (>= 1.
|
57
|
+
rexml (>= 3.2.5, < 4.0)
|
58
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
57
59
|
ruby-progressbar (~> 1.7)
|
58
|
-
unicode-display_width (>=
|
59
|
-
rubocop-ast (1.
|
60
|
-
parser (>= 3.
|
61
|
-
rubocop-bsm (0.6.
|
60
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
61
|
+
rubocop-ast (1.24.1)
|
62
|
+
parser (>= 3.1.1.0)
|
63
|
+
rubocop-bsm (0.6.1)
|
62
64
|
rubocop (~> 1.0)
|
63
65
|
rubocop-performance
|
64
66
|
rubocop-rake
|
65
67
|
rubocop-rspec
|
66
|
-
rubocop-
|
68
|
+
rubocop-capybara (2.17.0)
|
69
|
+
rubocop (~> 1.41)
|
70
|
+
rubocop-performance (1.15.2)
|
67
71
|
rubocop (>= 1.7.0, < 2.0)
|
68
72
|
rubocop-ast (>= 0.4.0)
|
69
|
-
rubocop-rake (0.
|
70
|
-
rubocop
|
71
|
-
rubocop-rspec (2.3.0)
|
73
|
+
rubocop-rake (0.6.0)
|
72
74
|
rubocop (~> 1.0)
|
73
|
-
|
75
|
+
rubocop-rspec (2.18.1)
|
76
|
+
rubocop (~> 1.33)
|
77
|
+
rubocop-capybara (~> 2.17)
|
74
78
|
ruby-progressbar (1.11.0)
|
75
|
-
sqlite3 (1.
|
76
|
-
|
79
|
+
sqlite3 (1.6.0)
|
80
|
+
mini_portile2 (~> 2.8.0)
|
81
|
+
tzinfo (2.0.6)
|
77
82
|
concurrent-ruby (~> 1.0)
|
78
|
-
unicode-display_width (2.
|
79
|
-
zeitwerk (2.4.2)
|
83
|
+
unicode-display_width (2.4.2)
|
80
84
|
|
81
85
|
PLATFORMS
|
82
86
|
ruby
|
@@ -92,4 +96,4 @@ DEPENDENCIES
|
|
92
96
|
sqlite3
|
93
97
|
|
94
98
|
BUNDLED WITH
|
95
|
-
2.
|
99
|
+
2.3.16
|
data/Gemfile.rails6
ADDED
data/Gemfile.rails6.lock
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
activesupport_cache_database (0.3.1)
|
5
|
+
activerecord (>= 6.0)
|
6
|
+
activesupport (>= 6.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activemodel (6.1.7.2)
|
12
|
+
activesupport (= 6.1.7.2)
|
13
|
+
activerecord (6.1.7.2)
|
14
|
+
activemodel (= 6.1.7.2)
|
15
|
+
activesupport (= 6.1.7.2)
|
16
|
+
activesupport (6.1.7.2)
|
17
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
+
i18n (>= 1.6, < 2)
|
19
|
+
minitest (>= 5.1)
|
20
|
+
tzinfo (~> 2.0)
|
21
|
+
zeitwerk (~> 2.3)
|
22
|
+
ast (2.4.2)
|
23
|
+
concurrent-ruby (1.2.0)
|
24
|
+
diff-lcs (1.5.0)
|
25
|
+
i18n (1.12.0)
|
26
|
+
concurrent-ruby (~> 1.0)
|
27
|
+
json (2.6.3)
|
28
|
+
minitest (5.17.0)
|
29
|
+
mysql2 (0.5.5)
|
30
|
+
parallel (1.22.1)
|
31
|
+
parser (3.2.0.0)
|
32
|
+
ast (~> 2.4.1)
|
33
|
+
pg (1.4.5)
|
34
|
+
rainbow (3.1.1)
|
35
|
+
rake (13.0.6)
|
36
|
+
regexp_parser (2.6.2)
|
37
|
+
rexml (3.2.5)
|
38
|
+
rspec (3.12.0)
|
39
|
+
rspec-core (~> 3.12.0)
|
40
|
+
rspec-expectations (~> 3.12.0)
|
41
|
+
rspec-mocks (~> 3.12.0)
|
42
|
+
rspec-core (3.12.0)
|
43
|
+
rspec-support (~> 3.12.0)
|
44
|
+
rspec-expectations (3.12.2)
|
45
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
+
rspec-support (~> 3.12.0)
|
47
|
+
rspec-mocks (3.12.3)
|
48
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
+
rspec-support (~> 3.12.0)
|
50
|
+
rspec-support (3.12.0)
|
51
|
+
rubocop (1.44.1)
|
52
|
+
json (~> 2.3)
|
53
|
+
parallel (~> 1.10)
|
54
|
+
parser (>= 3.2.0.0)
|
55
|
+
rainbow (>= 2.2.2, < 4.0)
|
56
|
+
regexp_parser (>= 1.8, < 3.0)
|
57
|
+
rexml (>= 3.2.5, < 4.0)
|
58
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
59
|
+
ruby-progressbar (~> 1.7)
|
60
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
61
|
+
rubocop-ast (1.24.1)
|
62
|
+
parser (>= 3.1.1.0)
|
63
|
+
rubocop-bsm (0.6.1)
|
64
|
+
rubocop (~> 1.0)
|
65
|
+
rubocop-performance
|
66
|
+
rubocop-rake
|
67
|
+
rubocop-rspec
|
68
|
+
rubocop-capybara (2.17.0)
|
69
|
+
rubocop (~> 1.41)
|
70
|
+
rubocop-performance (1.15.2)
|
71
|
+
rubocop (>= 1.7.0, < 2.0)
|
72
|
+
rubocop-ast (>= 0.4.0)
|
73
|
+
rubocop-rake (0.6.0)
|
74
|
+
rubocop (~> 1.0)
|
75
|
+
rubocop-rspec (2.18.1)
|
76
|
+
rubocop (~> 1.33)
|
77
|
+
rubocop-capybara (~> 2.17)
|
78
|
+
ruby-progressbar (1.11.0)
|
79
|
+
sqlite3 (1.6.0-x86_64-linux)
|
80
|
+
tzinfo (2.0.6)
|
81
|
+
concurrent-ruby (~> 1.0)
|
82
|
+
unicode-display_width (2.4.2)
|
83
|
+
zeitwerk (2.6.6)
|
84
|
+
|
85
|
+
PLATFORMS
|
86
|
+
x86_64-linux
|
87
|
+
|
88
|
+
DEPENDENCIES
|
89
|
+
activerecord (~> 6.1)
|
90
|
+
activesupport (~> 6.1)
|
91
|
+
activesupport_cache_database!
|
92
|
+
bundler
|
93
|
+
mysql2
|
94
|
+
pg
|
95
|
+
rake
|
96
|
+
rspec
|
97
|
+
rubocop-bsm
|
98
|
+
sqlite3
|
99
|
+
|
100
|
+
BUNDLED WITH
|
101
|
+
2.3.16
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'activesupport_cache_database'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.3.1'
|
4
4
|
s.authors = ['Black Square Media Ltd']
|
5
5
|
s.email = ['info@blacksquaremedia.com']
|
6
6
|
s.summary = %(ActiveSupport::Cache::Store implementation backed by ActiveRecord.)
|
@@ -9,18 +9,12 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.license = 'Apache-2.0'
|
10
10
|
|
11
11
|
s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^spec/}) }
|
12
|
-
s.test_files = `git ls-files -z -- spec/*`.split("\x0")
|
13
12
|
s.require_paths = ['lib']
|
14
|
-
s.required_ruby_version = '>= 2.
|
13
|
+
s.required_ruby_version = '>= 2.7'
|
15
14
|
|
16
|
-
s.add_dependency 'activerecord', '>=
|
17
|
-
s.add_dependency 'activesupport', '>=
|
15
|
+
s.add_dependency 'activerecord', '>= 6.0'
|
16
|
+
s.add_dependency 'activesupport', '>= 6.0'
|
18
17
|
|
19
18
|
s.add_development_dependency 'bundler'
|
20
|
-
s.
|
21
|
-
s.add_development_dependency 'pg'
|
22
|
-
s.add_development_dependency 'rake'
|
23
|
-
s.add_development_dependency 'rspec'
|
24
|
-
s.add_development_dependency 'rubocop-bsm'
|
25
|
-
s.add_development_dependency 'sqlite3'
|
19
|
+
s.metadata['rubygems_mfa_required'] = 'true'
|
26
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activesupport_cache_database
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Black Square Media Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '6.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '6.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '6.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,90 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: mysql2
|
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: pg
|
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: rake
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rspec
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop-bsm
|
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
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: sqlite3
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
55
|
description: Use your DB as a cache store
|
140
56
|
email:
|
141
57
|
- info@blacksquaremedia.com
|
@@ -149,6 +65,8 @@ files:
|
|
149
65
|
- ".rubocop.yml"
|
150
66
|
- Gemfile
|
151
67
|
- Gemfile.lock
|
68
|
+
- Gemfile.rails6
|
69
|
+
- Gemfile.rails6.lock
|
152
70
|
- LICENSE
|
153
71
|
- README.md
|
154
72
|
- Rakefile
|
@@ -157,12 +75,11 @@ files:
|
|
157
75
|
- lib/active_support/cache/database_store/migration.rb
|
158
76
|
- lib/active_support/cache/database_store/model.rb
|
159
77
|
- lib/activesupport_cache_database.rb
|
160
|
-
- spec/active_support/cache/database_store_spec.rb
|
161
|
-
- spec/spec_helper.rb
|
162
78
|
homepage: https://github.com/bsm/activesupport-cache-database
|
163
79
|
licenses:
|
164
80
|
- Apache-2.0
|
165
|
-
metadata:
|
81
|
+
metadata:
|
82
|
+
rubygems_mfa_required: 'true'
|
166
83
|
post_install_message:
|
167
84
|
rdoc_options: []
|
168
85
|
require_paths:
|
@@ -171,17 +88,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
88
|
requirements:
|
172
89
|
- - ">="
|
173
90
|
- !ruby/object:Gem::Version
|
174
|
-
version: '2.
|
91
|
+
version: '2.7'
|
175
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
93
|
requirements:
|
177
94
|
- - ">="
|
178
95
|
- !ruby/object:Gem::Version
|
179
96
|
version: '0'
|
180
97
|
requirements: []
|
181
|
-
rubygems_version: 3.
|
98
|
+
rubygems_version: 3.3.3
|
182
99
|
signing_key:
|
183
100
|
specification_version: 4
|
184
101
|
summary: ActiveSupport::Cache::Store implementation backed by ActiveRecord.
|
185
|
-
test_files:
|
186
|
-
- spec/active_support/cache/database_store_spec.rb
|
187
|
-
- spec/spec_helper.rb
|
102
|
+
test_files: []
|
@@ -1,329 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe ActiveSupport::Cache::DatabaseStore do
|
4
|
-
subject do
|
5
|
-
described_class.new expires_in: 60
|
6
|
-
end
|
7
|
-
|
8
|
-
it 'reads and write strings' do
|
9
|
-
expect(subject.write('foo', 'bar')).to be_truthy
|
10
|
-
expect(subject.read('foo')).to eq('bar')
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'reads and write hash' do
|
14
|
-
expect(subject.write('foo', a: 'b')).to be_truthy
|
15
|
-
expect(subject.read('foo')).to eq(a: 'b')
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'reads and write integer' do
|
19
|
-
expect(subject.write('foo', 1)).to be_truthy
|
20
|
-
expect(subject.read('foo')).to eq(1)
|
21
|
-
end
|
22
|
-
|
23
|
-
it 'reads and write nil' do
|
24
|
-
expect(subject.write('foo', nil)).to be_truthy
|
25
|
-
expect(subject.read('foo')).to eq(nil)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'reads and write false' do
|
29
|
-
expect(subject.write('foo', false)).to be_truthy
|
30
|
-
expect(subject.read('foo')).to eq(false)
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'overwrites' do
|
34
|
-
expect(subject.write('foo', 'bar')).to be_truthy
|
35
|
-
expect(subject.write('foo', 'baz')).to be_truthy
|
36
|
-
expect(subject.read('foo')).to eq('baz')
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'supports exist?' do
|
40
|
-
subject.write('foo', 'bar')
|
41
|
-
expect(subject).to exist('foo')
|
42
|
-
expect(subject).not_to exist('bar')
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'supports nil exist?' do
|
46
|
-
subject.write('foo', nil)
|
47
|
-
expect(subject).to exist('foo')
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'supports delete' do
|
51
|
-
subject.write('foo', 'bar')
|
52
|
-
expect(subject).to exist('foo')
|
53
|
-
expect(subject.delete('foo')).to be_truthy
|
54
|
-
expect(subject).not_to exist('foo')
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'supports expires_in' do
|
58
|
-
time = Time.local(2008, 4, 24)
|
59
|
-
allow(Time).to receive(:now).and_return(time)
|
60
|
-
|
61
|
-
subject.write('foo', 'bar')
|
62
|
-
expect(subject.read('foo')).to eq('bar')
|
63
|
-
|
64
|
-
allow(Time).to receive(:now).and_return(time + 30)
|
65
|
-
expect(subject.read('foo')).to eq('bar')
|
66
|
-
|
67
|
-
allow(Time).to receive(:now).and_return(time + 61)
|
68
|
-
expect(subject.read('foo')).to be_nil
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'supports long keys' do
|
72
|
-
key = 'x' * 255
|
73
|
-
expect(subject.write(key, 'bar')).to be_truthy
|
74
|
-
expect(subject.read(key)).to eq('bar')
|
75
|
-
expect(subject.fetch(key)).to eq('bar')
|
76
|
-
expect(subject.read(key[0..-2])).to be_nil
|
77
|
-
expect(subject.read_multi(key)).to eq(key => 'bar')
|
78
|
-
expect(subject.delete(key)).to be_truthy
|
79
|
-
|
80
|
-
expect { subject.write("#{key}x", 'bar') }.to raise_error(ArgumentError, /exceeds the length limit/)
|
81
|
-
expect { subject.read("#{key}x") }.to raise_error(ArgumentError, /exceeds the length limit/)
|
82
|
-
end
|
83
|
-
|
84
|
-
describe '#cleanup' do
|
85
|
-
it 'deletes expired' do
|
86
|
-
time = Time.now
|
87
|
-
subject.write('foo', 'bar', expires_in: 10)
|
88
|
-
subject.write('fud', 'biz', expires_in: 20)
|
89
|
-
|
90
|
-
allow(Time).to receive(:now).and_return(time + 9)
|
91
|
-
expect(subject.cleanup).to eq(0)
|
92
|
-
|
93
|
-
allow(Time).to receive(:now).and_return(time + 19)
|
94
|
-
expect(subject.cleanup).to eq(1)
|
95
|
-
expect(subject.read('foo')).to be_nil
|
96
|
-
expect(subject.read('fud')).to eq('biz')
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'supports namespace' do
|
100
|
-
time = Time.now
|
101
|
-
subject.write('foo', 'bar', expires_in: 10, namespace: 'x')
|
102
|
-
subject.write('foo', 'biz', expires_in: 10, namespace: 'y')
|
103
|
-
|
104
|
-
allow(Time).to receive(:now).and_return(time + 11)
|
105
|
-
expect(subject.count).to eq(0)
|
106
|
-
expect(subject.count(all: true)).to eq(2)
|
107
|
-
|
108
|
-
expect(subject.cleanup(namespace: 'x')).to eq(1)
|
109
|
-
expect(subject.count).to eq(0)
|
110
|
-
expect(subject.count(all: true)).to eq(1)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe '#clear' do
|
115
|
-
it 'removes all entries' do
|
116
|
-
subject.write('foo', 'bar')
|
117
|
-
subject.write('fud', 'biz')
|
118
|
-
expect(subject.clear).to be_truthy
|
119
|
-
expect(subject.read('foo')).to be_nil
|
120
|
-
expect(subject.read('fud')).to be_nil
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'supports namespace' do
|
124
|
-
subject.write('foo', 'bar', namespace: 'x')
|
125
|
-
subject.write('foo', 'biz', namespace: 'y')
|
126
|
-
expect(subject.count).to eq(2)
|
127
|
-
|
128
|
-
expect(subject.clear(namespace: 'x')).to be_truthy
|
129
|
-
expect(subject.count).to eq(1)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
describe '#fetch' do
|
134
|
-
it 'supports cache hit' do
|
135
|
-
subject.write('foo', 'bar')
|
136
|
-
expect(subject).not_to receive(:write)
|
137
|
-
|
138
|
-
expect(subject.fetch('foo') { 'baz' }).to eq('bar')
|
139
|
-
end
|
140
|
-
|
141
|
-
it 'supports cache miss' do
|
142
|
-
expect(subject).to receive(:write).with('foo', 'baz', instance_of(Hash))
|
143
|
-
expect(subject.fetch('foo') { 'baz' }).to eq('baz')
|
144
|
-
end
|
145
|
-
|
146
|
-
it 'passes key to block on cache miss' do
|
147
|
-
cache_miss = false
|
148
|
-
expect(subject.fetch('foo') {|key| cache_miss = true; key.length }).to eq(3)
|
149
|
-
expect(cache_miss).to be_truthy
|
150
|
-
|
151
|
-
cache_miss = false
|
152
|
-
expect(subject.fetch('foo') {|key| cache_miss = true; key.length }).to eq(3)
|
153
|
-
expect(cache_miss).to be_falsey
|
154
|
-
end
|
155
|
-
|
156
|
-
it 'supports forced cache miss' do
|
157
|
-
subject.write('foo', 'bar')
|
158
|
-
expect(subject).not_to receive(:read)
|
159
|
-
|
160
|
-
expect(subject.fetch('foo', force: true) { 'baz' }).to eq('baz')
|
161
|
-
end
|
162
|
-
|
163
|
-
it 'supports nil values' do
|
164
|
-
subject.write('foo', nil)
|
165
|
-
expect(subject).not_to receive(:write)
|
166
|
-
|
167
|
-
expect(subject.fetch('foo') { 'baz' }).to be_nil
|
168
|
-
end
|
169
|
-
|
170
|
-
it 'supports skip_nil option' do
|
171
|
-
expect(subject).not_to receive(:write)
|
172
|
-
expect(subject.fetch('foo', skip_nil: true) { nil }).to be_nil
|
173
|
-
expect(subject).not_to exist('foo')
|
174
|
-
end
|
175
|
-
|
176
|
-
it 'supports forced cache miss with block' do
|
177
|
-
subject.write('foo', 'bar')
|
178
|
-
expect(subject.fetch('foo', force: true) { 'baz' }).to eq('baz')
|
179
|
-
end
|
180
|
-
|
181
|
-
it 'supports forced cache miss without block' do
|
182
|
-
subject.write('foo', 'bar')
|
183
|
-
expect { subject.fetch('foo', force: true) }.to raise_error(ArgumentError)
|
184
|
-
expect(subject.read('foo')).to eq('bar')
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
describe '#read_multi' do
|
189
|
-
it 'supports read_multi' do
|
190
|
-
subject.write('foo', 'bar')
|
191
|
-
subject.write('fu', 'baz')
|
192
|
-
subject.write('fud', 'biz')
|
193
|
-
expect(subject.read_multi('foo', 'fu')).to eq('foo' => 'bar', 'fu' => 'baz')
|
194
|
-
end
|
195
|
-
|
196
|
-
it 'supports expires' do
|
197
|
-
time = Time.now
|
198
|
-
subject.write('foo', 'bar', expires_in: 10)
|
199
|
-
subject.write('fu', 'baz')
|
200
|
-
subject.write('fud', 'biz')
|
201
|
-
|
202
|
-
allow(Time).to receive(:now).and_return(time + 11)
|
203
|
-
expect(subject.read_multi('foo', 'fu')).to eq('fu' => 'baz')
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
describe '#fetch_multi' do
|
208
|
-
it 'supports fetch_multi' do
|
209
|
-
subject.write('foo', 'bar')
|
210
|
-
subject.write('fud', 'biz')
|
211
|
-
values = subject.fetch_multi('foo', 'fu', 'fud') {|v| v * 2 }
|
212
|
-
|
213
|
-
expect(values).to eq('foo' => 'bar', 'fu' => 'fufu', 'fud' => 'biz')
|
214
|
-
expect(subject.read('fu')).to eq('fufu')
|
215
|
-
end
|
216
|
-
|
217
|
-
it 'supports without expires_in' do
|
218
|
-
subject.write('foo', 'bar')
|
219
|
-
subject.write('fud', 'biz')
|
220
|
-
values = subject.fetch_multi('foo', 'fu', 'fud', expires_in: nil) {|v| v * 2 }
|
221
|
-
|
222
|
-
expect(values).to eq('foo' => 'bar', 'fu' => 'fufu', 'fud' => 'biz')
|
223
|
-
expect(subject.read('fu')).to eq('fufu')
|
224
|
-
end
|
225
|
-
|
226
|
-
it 'supports with objects' do
|
227
|
-
cache_struct = Struct.new(:cache_key, :title)
|
228
|
-
foo = cache_struct.new('foo', 'FOO!')
|
229
|
-
bar = cache_struct.new('bar')
|
230
|
-
|
231
|
-
subject.write('bar', 'BAM!')
|
232
|
-
values = subject.fetch_multi(foo, bar, &:title)
|
233
|
-
expect(values).to eq(foo => 'FOO!', bar => 'BAM!')
|
234
|
-
end
|
235
|
-
|
236
|
-
it 'supports ordered names' do
|
237
|
-
subject.write('bam', 'BAM')
|
238
|
-
values = subject.fetch_multi('foo', 'bar', 'bam', &:upcase)
|
239
|
-
expect(values.keys).to eq(%w[foo bar bam])
|
240
|
-
end
|
241
|
-
|
242
|
-
it 'raises without block' do
|
243
|
-
expect { subject.fetch_multi('foo') }.to raise_error(ArgumentError)
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
247
|
-
describe 'cache key' do
|
248
|
-
it 'supports cache keys' do
|
249
|
-
obj = Object.new
|
250
|
-
def obj.cache_key
|
251
|
-
:foo
|
252
|
-
end
|
253
|
-
subject.write(obj, 'bar')
|
254
|
-
expect(subject.read('foo')).to eq('bar')
|
255
|
-
end
|
256
|
-
|
257
|
-
it 'supports to_param keys' do
|
258
|
-
obj = Class.new do
|
259
|
-
def to_param
|
260
|
-
'foo'
|
261
|
-
end
|
262
|
-
end.new
|
263
|
-
subject.write(obj, 'bar')
|
264
|
-
expect(subject.read('foo')).to eq('bar')
|
265
|
-
end
|
266
|
-
|
267
|
-
it 'supports unversioned keys' do
|
268
|
-
obj = Object.new
|
269
|
-
def obj.cache_key
|
270
|
-
:foo
|
271
|
-
end
|
272
|
-
|
273
|
-
def obj.cache_key_with_version
|
274
|
-
'foo-v1'
|
275
|
-
end
|
276
|
-
subject.write(obj, 'bar')
|
277
|
-
expect(subject.read('foo')).to eq('bar')
|
278
|
-
end
|
279
|
-
|
280
|
-
it 'supports array keys' do
|
281
|
-
subject.write([:fu, 'foo'], 'bar')
|
282
|
-
expect(subject.read('fu/foo')).to eq('bar')
|
283
|
-
end
|
284
|
-
|
285
|
-
it 'supports hash keys' do
|
286
|
-
subject.write({ foo: 1, fu: 2 }, 'bar')
|
287
|
-
expect(subject.read('foo=1/fu=2')).to eq('bar')
|
288
|
-
end
|
289
|
-
|
290
|
-
it 'is case sensitive' do
|
291
|
-
subject.write('foo', 'bar')
|
292
|
-
expect(subject.read('FOO')).to be_nil
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
describe 'with version' do
|
297
|
-
it 'supports fetch/read' do
|
298
|
-
subject.fetch('foo', version: 1) { 'bar' }
|
299
|
-
expect(subject.read('foo', version: 1)).to eq('bar')
|
300
|
-
expect(subject.read('foo', version: 2)).to be_nil
|
301
|
-
end
|
302
|
-
|
303
|
-
it 'supports write/read' do
|
304
|
-
subject.write('foo', 'bar', version: 1)
|
305
|
-
expect(subject.read('foo', version: 1)).to eq('bar')
|
306
|
-
expect(subject.read('foo', version: 2)).to be_nil
|
307
|
-
end
|
308
|
-
|
309
|
-
it 'supports exists' do
|
310
|
-
subject.write('foo', 'bar', version: 1)
|
311
|
-
expect(subject).to exist('foo', version: 1)
|
312
|
-
expect(subject).not_to exist('foo', version: 2)
|
313
|
-
end
|
314
|
-
|
315
|
-
it 'cache/versions keys' do
|
316
|
-
m1v1 = ModelWithKeyAndVersion.new('model/1', 1)
|
317
|
-
m1v2 = ModelWithKeyAndVersion.new('model/1', 2)
|
318
|
-
|
319
|
-
subject.write(m1v1, 'bar')
|
320
|
-
expect(subject.read(m1v1)).to eq('bar')
|
321
|
-
expect(subject.read(m1v2)).to be_nil
|
322
|
-
end
|
323
|
-
|
324
|
-
it 'normalises' do
|
325
|
-
subject.write('foo', 'bar', version: 1)
|
326
|
-
expect(subject.read('foo', version: '1')).to eq('bar')
|
327
|
-
end
|
328
|
-
end
|
329
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
ENV['RACK_ENV'] ||= 'test'
|
2
|
-
|
3
|
-
require 'rspec'
|
4
|
-
require 'fileutils'
|
5
|
-
require 'activesupport_cache_database'
|
6
|
-
|
7
|
-
Time.zone_default = Time.find_zone!('UTC')
|
8
|
-
|
9
|
-
database_url = ENV.fetch('DATABASE_URL') do
|
10
|
-
path = File.expand_path('./test.sqlite3', __dir__)
|
11
|
-
FileUtils.rm_f(path)
|
12
|
-
"sqlite3://#{path}"
|
13
|
-
end
|
14
|
-
ActiveRecord::Base.configurations = { 'test' => { 'url' => database_url, 'pool' => 20 } }
|
15
|
-
|
16
|
-
ActiveRecord::Base.establish_connection :test
|
17
|
-
ActiveRecord::Base.connection.instance_eval do
|
18
|
-
drop_table 'activesupport_cache_entries', if_exists: true
|
19
|
-
end
|
20
|
-
ActiveRecord::Migration.suppress_messages do
|
21
|
-
ActiveSupport::Cache::DatabaseStore::Migration.migrate(:up)
|
22
|
-
end
|
23
|
-
|
24
|
-
RSpec.configure do |c|
|
25
|
-
c.after do
|
26
|
-
ActiveSupport::Cache::DatabaseStore::Model.truncate!
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
ModelWithKeyAndVersion = Struct.new(:cache_key, :cache_version)
|