supercache 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/supercache/super_query_cache.rb +20 -1
- data/lib/supercache/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: 64dca14fbf1ff01ab959efeb420e031dd41decc5
|
4
|
+
data.tar.gz: 93a8bfe49a498e6e79fba471cadccbe47536c05a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3370e88946a0d7d2ba57b73dbb52b2db26d2b8f13073778b3236dca78b6934579bcf98c18e0e15efffe08c2e3ba3e1f87b1a6e714801956cba5d1a5a13e3aba
|
7
|
+
data.tar.gz: 4dc6083f8e3e3491e3d21d4875743f3446b1957f77687fe2c2396f6a13fb1ba0c518b77f4a969f9b86cb653dfe11bdf03dae74846e3842e35ca3eef44c7cc783
|
@@ -1,5 +1,20 @@
|
|
1
|
+
module SuperQueryCacheRails51AndAbove
|
2
|
+
#Because of https://github.com/rails/rails/commit/84d35da86c14767c737783cb95dd4624632cc1bd
|
3
|
+
def cache_sql(*args, name, &block)
|
4
|
+
if Rails.cache.read(:ar_supercache)
|
5
|
+
sub_key = name.collect{|a| "#{a.try(:name)} #{a.try(:value)}"}
|
6
|
+
Rails.cache.fetch(Digest::SHA1.hexdigest("supercache_#{args[0]}_#{sub_key}")) do
|
7
|
+
super(*args, name, &block)
|
8
|
+
end
|
9
|
+
else
|
10
|
+
super(*args, name, &block)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
1
15
|
module SuperQueryCache
|
2
16
|
def cache_sql(*args, &block)
|
17
|
+
binding.pry
|
3
18
|
if Rails.cache.read(:ar_supercache)
|
4
19
|
sub_key = args[1].collect{|a| "#{a.try(:name)} #{a.try(:value)}"}
|
5
20
|
Rails.cache.fetch(Digest::SHA1.hexdigest("supercache_#{args[0]}_#{sub_key}")) do
|
@@ -11,4 +26,8 @@ module SuperQueryCache
|
|
11
26
|
end
|
12
27
|
end
|
13
28
|
|
14
|
-
|
29
|
+
if (Rails::VERSION::MAJOR > 5) || (Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR >= 1)
|
30
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(SuperQueryCacheRails51AndAbove)
|
31
|
+
else
|
32
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(SuperQueryCache)
|
33
|
+
end
|
data/lib/supercache/version.rb
CHANGED