second_level_cache 2.4.2 → 2.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf466732a8f99204779ce80418071b7132abcc8f375ca5f7e98d8c067ad55c1f
4
- data.tar.gz: c800e784340496decd81ce340bdf32fb85938f50c25d5279f29ae11d292acd2c
3
+ metadata.gz: 3ff0808eae35d2e443ca1160f93eaa9f23f9b1267e4338d3d89fca45715d0fbf
4
+ data.tar.gz: 1daad06b799d5506b2dff7cb23c898af371612cb38cc8963d24ea9276c66b30b
5
5
  SHA512:
6
- metadata.gz: ba4fa6bd084ca3ed320597b4584eeafe7c4392b731a441a6981b648b660734685526f6899e2d4bacd8b46d6d64a3c0b7c75ed50e2b9002393b5cd1cb878041ac
7
- data.tar.gz: d712535540abc0fdaab51fcd8e45b4f53701d2f17f4dff6c133006bba8a153a1db531544361535e62300d55bc8785aca0ffde346e60d49e0616543b03d2bd4a1
6
+ metadata.gz: 564bd8a1dfeebb096450334bca5c077df923ffc6120e72d025188c1d47b8a705e003ff24f0698b59b0b60d32c877a90cb158286299c0683142bbe6612b31416d
7
+ data.tar.gz: efaf40b630af426f52538468c96b6d7ea24e14ed4137c3fedccadcc8de7c2c9c82c86b6ccf48d98a7c712e8d470ad997cb902199412f517ed5ebfa0187538cbe
@@ -1,3 +1,18 @@
1
+ 2.4.3
2
+ -------
3
+
4
+ - Fix caching for STI model. (#78)
5
+
6
+ 2.4.2
7
+ -------
8
+
9
+ - Fix for work with Paranoia gem. (#77)
10
+
11
+ 2.4.1
12
+ -------
13
+
14
+ - Fix relation finder. (#75)
15
+
1
16
  2.4.0
2
17
  ---------
3
18
 
data/README.md CHANGED
@@ -170,12 +170,14 @@ Answer Load (0.2ms) SELECT `answers`.* FROM `answers` ORDER BY id DESC LIMIT 10
170
170
 
171
171
  [Details for read_multi feature](http://hooopo.writings.io/articles/a9cae5e0).
172
172
 
173
- ## Contributors
173
+ ## Original design by:
174
174
 
175
175
  * [chloerei](https://github.com/chloerei)
176
- * [reyesyang](https://github.com/reyesyang)
177
176
  * [hooopo](https://github.com/hooopo)
178
- * [sishen](https://github.com/sishen)
177
+
178
+ ## Contributors
179
+
180
+ [Contributor List](https://github.com/hooopo/second_level_cache/graphs/contributors)
179
181
 
180
182
  ## License
181
183
 
@@ -62,18 +62,22 @@ module SecondLevelCache
62
62
  end
63
63
 
64
64
  def second_level_cache_key
65
- self.class.second_level_cache_key(id)
65
+ klass.second_level_cache_key(id)
66
+ end
67
+
68
+ def klass
69
+ self.class.base_class
66
70
  end
67
71
 
68
72
  def expire_second_level_cache
69
- return unless self.class.second_level_cache_enabled?
73
+ return unless klass.second_level_cache_enabled?
70
74
  SecondLevelCache.cache_store.delete(second_level_cache_key)
71
75
  end
72
76
 
73
77
  def write_second_level_cache
74
- return unless self.class.second_level_cache_enabled?
78
+ return unless klass.second_level_cache_enabled?
75
79
  marshal = RecordMarshal.dump(self)
76
- expires_in = self.class.second_level_cache_options[:expires_in]
80
+ expires_in = klass.second_level_cache_options[:expires_in]
77
81
  expire_changed_association_uniq_keys
78
82
  SecondLevelCache.cache_store.write(second_level_cache_key, marshal, expires_in: expires_in)
79
83
  end
@@ -81,10 +85,10 @@ module SecondLevelCache
81
85
  alias update_second_level_cache write_second_level_cache
82
86
 
83
87
  def expire_changed_association_uniq_keys
84
- reflections = self.class.reflections.select { |_, reflection| reflection.belongs_to? }
88
+ reflections = klass.reflections.select { |_, reflection| reflection.belongs_to? }
85
89
  changed_keys = reflections.map { |_, reflection| reflection.foreign_key } & previous_changes.keys
86
90
  changed_keys.each do |key|
87
- SecondLevelCache.cache_store.delete(self.class.send(:cache_uniq_key, key => previous_changes[key][0]))
91
+ SecondLevelCache.cache_store.delete(klass.send(:cache_uniq_key, key => previous_changes[key][0]))
88
92
  end
89
93
  end
90
94
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SecondLevelCache
4
- VERSION = "2.4.2"
4
+ VERSION = "2.4.3"
5
5
  end
@@ -13,3 +13,6 @@ end
13
13
  class Dog < Animal
14
14
  second_level_cache
15
15
  end
16
+
17
+ class Cat < Animal
18
+ end
@@ -34,4 +34,11 @@ class SingleTableInheritanceTest < ActiveSupport::TestCase
34
34
  end
35
35
  end
36
36
  end
37
+
38
+ def test_superclass_find__caches_all_subclasses
39
+ cat = Cat.create
40
+ assert_no_queries do
41
+ assert_equal cat, Animal.find(cat.id)
42
+ end
43
+ end
37
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: second_level_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hooopo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-09 00:00:00.000000000 Z
11
+ date: 2018-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
192
  version: '0'
193
193
  requirements: []
194
194
  rubyforge_project:
195
- rubygems_version: 2.7.3
195
+ rubygems_version: 2.7.6
196
196
  signing_key:
197
197
  specification_version: 4
198
198
  summary: 'SecondLevelCache is a write-through and read-through caching library inspired
@@ -202,28 +202,28 @@ summary: 'SecondLevelCache is a write-through and read-through caching library i
202
202
  is a cache miss, it will populate the cache. Write-Through: As objects are created,
203
203
  updated, and deleted, all of the caches are automatically kept up-to-date and coherent.'
204
204
  test_files:
205
- - test/active_record_test_case_helper.rb
206
- - test/base_test.rb
205
+ - test/polymorphic_association_test.rb
206
+ - test/require_test.rb
207
+ - test/preloader_test.rb
208
+ - test/finder_methods_test.rb
209
+ - test/preloader_non_integer_test.rb
207
210
  - test/belongs_to_association_test.rb
211
+ - test/second_level_cache_test.rb
208
212
  - test/enum_attr_test.rb
209
- - test/fetch_by_uniq_key_test.rb
210
- - test/finder_methods_test.rb
211
- - test/has_one_association_test.rb
213
+ - test/record_marshal_test.rb
214
+ - test/persistence_test.rb
215
+ - test/single_table_inheritance_test.rb
216
+ - test/model/image.rb
212
217
  - test/model/account.rb
213
- - test/model/animal.rb
218
+ - test/model/order_item.rb
214
219
  - test/model/book.rb
215
- - test/model/image.rb
220
+ - test/model/topic.rb
221
+ - test/model/animal.rb
216
222
  - test/model/order.rb
217
- - test/model/order_item.rb
218
223
  - test/model/post.rb
219
- - test/model/topic.rb
220
224
  - test/model/user.rb
221
- - test/persistence_test.rb
222
- - test/polymorphic_association_test.rb
223
- - test/preloader_non_integer_test.rb
224
- - test/preloader_test.rb
225
- - test/record_marshal_test.rb
226
- - test/require_test.rb
227
- - test/second_level_cache_test.rb
228
- - test/single_table_inheritance_test.rb
225
+ - test/fetch_by_uniq_key_test.rb
229
226
  - test/test_helper.rb
227
+ - test/has_one_association_test.rb
228
+ - test/base_test.rb
229
+ - test/active_record_test_case_helper.rb