Module: SuperQueryCache

Defined in:
lib/supercache/super_query_cache.rb

Instance Method Summary collapse

Instance Method Details

#cache_sql(*args, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/supercache/super_query_cache.rb', line 16

def cache_sql(*args, &block)
  binding.pry
  if Rails.cache.read(:ar_supercache)
    sub_key = args[1].collect{|a| "#{a.try(:name)} #{a.try(:value)}"}
    Rails.cache.fetch(Digest::SHA1.hexdigest("supercache_#{args[0]}_#{sub_key}")) do
      super(*args, &block)
    end
  else
    super(*args, &block)
  end
end