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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bff91563a08d2c564330e05fe3274bd48fa20fbf
4
- data.tar.gz: 26b33642dc3e44083e00cd35e9f55bcfc4437c58
3
+ metadata.gz: 64dca14fbf1ff01ab959efeb420e031dd41decc5
4
+ data.tar.gz: 93a8bfe49a498e6e79fba471cadccbe47536c05a
5
5
  SHA512:
6
- metadata.gz: 4d88fabef842e4ad59b53b2634a224f9e18c420c2f5f8c97c0ba588a213ec0d6869c6218b4c732b4689049df126efe04773c5de8c415beecdc03e125284f60c4
7
- data.tar.gz: 8c88c8e349af7f7f2e2cf846c29fbfdb7475da4308b8d7b3d63878eabe8e2a2dca2b62e0a099fa2349aece80c259acd1439e1e5db4d0a8d30b08ff93cbc97acd
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
- ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(SuperQueryCache)
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
@@ -1,3 +1,3 @@
1
1
  module Supercache
2
- VERSION = "0.7.1"
2
+ VERSION = "0.7.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supercache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bragadeesh J