activesupport_cache_database 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +40 -37
- data/activesupport_cache_database.gemspec +1 -1
- data/lib/active_support/cache/database_store.rb +9 -9
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 973852575f17d5bc8f4faf071724c054068e5ab070782dce02844a72d418dd2a
|
|
4
|
+
data.tar.gz: 7551068640fe8e9c00f0e7e4474909d21bcd05b8881723fe6907f9b152e278c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6420375b2577ed8f62df452e71d7d280d343d193666d52c36fa5a3aea4d57eac1e3ca81e902ad5ef141ce5190d829f488a8ec0686ee0d6b18481cdb55deadbd2
|
|
7
|
+
data.tar.gz: d79407e5d25930e3b5fe96785b9e953c293a3eb7825c288525b1a73252b151b09ab7976fd1360adf4c43fb3ad55eba2e237071720c6f9473f2efbcab512a59a1
|
data/Gemfile.lock
CHANGED
|
@@ -1,65 +1,68 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
activesupport_cache_database (0.1.
|
|
4
|
+
activesupport_cache_database (0.1.2)
|
|
5
5
|
activerecord (>= 5.0)
|
|
6
6
|
activesupport (>= 5.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
activemodel (6.0.
|
|
12
|
-
activesupport (= 6.0.
|
|
13
|
-
activerecord (6.0.
|
|
14
|
-
activemodel (= 6.0.
|
|
15
|
-
activesupport (= 6.0.
|
|
16
|
-
activesupport (6.0.
|
|
11
|
+
activemodel (6.0.3.1)
|
|
12
|
+
activesupport (= 6.0.3.1)
|
|
13
|
+
activerecord (6.0.3.1)
|
|
14
|
+
activemodel (= 6.0.3.1)
|
|
15
|
+
activesupport (= 6.0.3.1)
|
|
16
|
+
activesupport (6.0.3.1)
|
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
18
18
|
i18n (>= 0.7, < 2)
|
|
19
19
|
minitest (~> 5.1)
|
|
20
20
|
tzinfo (~> 1.1)
|
|
21
|
-
zeitwerk (~> 2.
|
|
21
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
|
22
22
|
ast (2.4.0)
|
|
23
|
-
concurrent-ruby (1.1.
|
|
23
|
+
concurrent-ruby (1.1.6)
|
|
24
24
|
diff-lcs (1.3)
|
|
25
|
-
i18n (1.
|
|
25
|
+
i18n (1.8.2)
|
|
26
26
|
concurrent-ruby (~> 1.0)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
parser (2.6.4.1)
|
|
27
|
+
minitest (5.14.1)
|
|
28
|
+
mysql2 (0.5.3)
|
|
29
|
+
parallel (1.19.1)
|
|
30
|
+
parser (2.7.1.3)
|
|
32
31
|
ast (~> 2.4.0)
|
|
33
|
-
pg (1.
|
|
32
|
+
pg (1.2.3)
|
|
34
33
|
rainbow (3.0.0)
|
|
35
|
-
rake (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
rspec-
|
|
39
|
-
rspec-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
rake (13.0.1)
|
|
35
|
+
rexml (3.2.4)
|
|
36
|
+
rspec (3.9.0)
|
|
37
|
+
rspec-core (~> 3.9.0)
|
|
38
|
+
rspec-expectations (~> 3.9.0)
|
|
39
|
+
rspec-mocks (~> 3.9.0)
|
|
40
|
+
rspec-core (3.9.2)
|
|
41
|
+
rspec-support (~> 3.9.3)
|
|
42
|
+
rspec-expectations (3.9.2)
|
|
43
43
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
44
|
-
rspec-support (~> 3.
|
|
45
|
-
rspec-mocks (3.
|
|
44
|
+
rspec-support (~> 3.9.0)
|
|
45
|
+
rspec-mocks (3.9.1)
|
|
46
46
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
47
|
-
rspec-support (~> 3.
|
|
48
|
-
rspec-support (3.
|
|
49
|
-
rubocop (0.
|
|
50
|
-
jaro_winkler (~> 1.5.1)
|
|
47
|
+
rspec-support (~> 3.9.0)
|
|
48
|
+
rspec-support (3.9.3)
|
|
49
|
+
rubocop (0.84.0)
|
|
51
50
|
parallel (~> 1.10)
|
|
52
|
-
parser (>= 2.
|
|
51
|
+
parser (>= 2.7.0.1)
|
|
53
52
|
rainbow (>= 2.2.2, < 4.0)
|
|
53
|
+
rexml
|
|
54
|
+
rubocop-ast (>= 0.0.3)
|
|
54
55
|
ruby-progressbar (~> 1.7)
|
|
55
|
-
unicode-display_width (>= 1.4.0, <
|
|
56
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
57
|
+
rubocop-ast (0.0.3)
|
|
58
|
+
parser (>= 2.7.0.1)
|
|
56
59
|
ruby-progressbar (1.10.1)
|
|
57
|
-
sqlite3 (1.4.
|
|
60
|
+
sqlite3 (1.4.2)
|
|
58
61
|
thread_safe (0.3.6)
|
|
59
|
-
tzinfo (1.2.
|
|
62
|
+
tzinfo (1.2.7)
|
|
60
63
|
thread_safe (~> 0.1)
|
|
61
|
-
unicode-display_width (1.
|
|
62
|
-
zeitwerk (2.
|
|
64
|
+
unicode-display_width (1.7.0)
|
|
65
|
+
zeitwerk (2.3.0)
|
|
63
66
|
|
|
64
67
|
PLATFORMS
|
|
65
68
|
ruby
|
|
@@ -75,4 +78,4 @@ DEPENDENCIES
|
|
|
75
78
|
sqlite3
|
|
76
79
|
|
|
77
80
|
BUNDLED WITH
|
|
78
|
-
2.
|
|
81
|
+
2.1.4
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'activesupport_cache_database'
|
|
3
|
-
s.version = '0.1.
|
|
3
|
+
s.version = '0.1.2'
|
|
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.)
|
|
@@ -15,13 +15,13 @@ module ActiveSupport
|
|
|
15
15
|
|
|
16
16
|
# param [Hash] options options
|
|
17
17
|
# option options [Class] :model model class. Default: ActiveSupport::Cache::DatabaseStore::Model
|
|
18
|
-
def initialize(options=nil)
|
|
18
|
+
def initialize(options = nil)
|
|
19
19
|
@model = (options || {}).delete(:model) || Model
|
|
20
20
|
super(options)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
# Preemptively iterates through all stored keys and removes the ones which have expired.
|
|
24
|
-
def cleanup(options=nil)
|
|
24
|
+
def cleanup(options = nil)
|
|
25
25
|
options = merged_options(options)
|
|
26
26
|
scope = @model.expired
|
|
27
27
|
if (namespace = options[:namespace])
|
|
@@ -31,7 +31,7 @@ module ActiveSupport
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
# Clears the entire cache. Be careful with this method.
|
|
34
|
-
def clear(options=nil)
|
|
34
|
+
def clear(options = nil)
|
|
35
35
|
options = merged_options(options)
|
|
36
36
|
if (namespace = options[:namespace])
|
|
37
37
|
@model.namespaced(namespace).delete_all
|
|
@@ -42,7 +42,7 @@ module ActiveSupport
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
# Calculates the number of entries in the cache.
|
|
45
|
-
def count(options=nil)
|
|
45
|
+
def count(options = nil)
|
|
46
46
|
options = merged_options(options)
|
|
47
47
|
scope = @model.all
|
|
48
48
|
if (namespace = options[:namespace])
|
|
@@ -54,24 +54,24 @@ module ActiveSupport
|
|
|
54
54
|
|
|
55
55
|
private
|
|
56
56
|
|
|
57
|
-
def normalize_key(name, options=nil)
|
|
57
|
+
def normalize_key(name, options = nil)
|
|
58
58
|
key = super.to_s
|
|
59
59
|
raise ArgumentError, 'Namespaced key exceeds the length limit' if key && key.bytesize > 255
|
|
60
60
|
|
|
61
61
|
key
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
def read_entry(key, _options=nil)
|
|
64
|
+
def read_entry(key, _options = nil)
|
|
65
65
|
from_record @model.where(key: key).first
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
def write_entry(key, entry, _options=nil)
|
|
68
|
+
def write_entry(key, entry, _options = nil)
|
|
69
69
|
record = @model.where(key: key).first_or_initialize
|
|
70
70
|
expires_at = Time.zone.at(entry.expires_at) if entry.expires_at
|
|
71
71
|
record.update! value: Marshal.dump(entry.value), version: entry.version.presence, expires_at: expires_at
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
-
def delete_entry(key, _options=nil)
|
|
74
|
+
def delete_entry(key, _options = nil)
|
|
75
75
|
@model.where(key: key).destroy_all
|
|
76
76
|
end
|
|
77
77
|
|
|
@@ -89,7 +89,7 @@ module ActiveSupport
|
|
|
89
89
|
next if entry.nil?
|
|
90
90
|
|
|
91
91
|
if entry.expired?
|
|
92
|
-
delete_entry(rec.key, options)
|
|
92
|
+
delete_entry(rec.key, **options)
|
|
93
93
|
elsif entry.mismatched?(version)
|
|
94
94
|
# Skip mismatched versions
|
|
95
95
|
else
|
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.1.
|
|
4
|
+
version: 0.1.2
|
|
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: 2020-05-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -178,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
178
178
|
- !ruby/object:Gem::Version
|
|
179
179
|
version: '0'
|
|
180
180
|
requirements: []
|
|
181
|
-
rubygems_version: 3.
|
|
181
|
+
rubygems_version: 3.1.2
|
|
182
182
|
signing_key:
|
|
183
183
|
specification_version: 4
|
|
184
184
|
summary: ActiveSupport::Cache::Store implementation backed by ActiveRecord.
|