api_hammer 0.3.2 → 0.3.3
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/CHANGELOG.md +3 -0
- data/lib/api_hammer/active_record_cache_find_by.rb +4 -5
- data/lib/api_hammer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62d257b84cb30c253738ffe4485eac1a378d9443
|
4
|
+
data.tar.gz: 804dfcd511a7c027f64d72eb62070f4c6698a058
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 587cd1a5b4e437b1871dfbb890b1c333c9d427cd178f5af2dd3ef0b52de6eade49504ba460259eecd57e10ffefb8413bf8917f64f66f0ad82ccfdbdefd7e4493
|
7
|
+
data.tar.gz: cf1a2c017ff9690c7245626a8609e56c4ec0a4d56cc102285913a7ac6132fa6a2090380cb1129b575175ded4aa7eadc0f61f77d47186f5ee2c4a6b5e86eee262
|
data/CHANGELOG.md
CHANGED
@@ -67,7 +67,10 @@ module ActiveRecord
|
|
67
67
|
# by default uses Rails.cache if that exists, or creates a ActiveSupport::Cache::MemoryStore to use.
|
68
68
|
# set this per-model or on ActiveRecord::Base, as needed; it is inherited.
|
69
69
|
def finder_cache
|
70
|
-
#
|
70
|
+
# if this looks weird, it kind of is. on the first invocation of #finder_cache, we call finder_cache=
|
71
|
+
# which overwrites the finder_cache method, and this then calls the newly defined method.
|
72
|
+
self.finder_cache = (Object.const_defined?(:Rails) && ::Rails.cache) || ::ActiveSupport::Cache::MemoryStore.new
|
73
|
+
self.finder_cache
|
71
74
|
end
|
72
75
|
|
73
76
|
# causes requests to retrieve a record by the given attributes (all of them) to be cached.
|
@@ -117,10 +120,6 @@ module ActiveRecord
|
|
117
120
|
end
|
118
121
|
end
|
119
122
|
|
120
|
-
# the above dummy method has no content because we want to evaluate this now, not in the method, to
|
121
|
-
# avoid instantiating duplicate MemoryStores.
|
122
|
-
self.finder_cache = (Object.const_defined?(:Rails) && ::Rails.cache) || ::ActiveSupport::Cache::MemoryStore.new
|
123
|
-
|
124
123
|
# clears this record from the cache used by cache_find_by
|
125
124
|
def flush_find_cache
|
126
125
|
self.class.send(:cache_find_bys).each do |attribute_names|
|
data/lib/api_hammer/version.rb
CHANGED