Template:Box Code: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
(Caching in Rails)
 
mNo edit summary
 
Line 1: Line 1:
Benchmark.measure do
  Benchmark.measure do
  Rails.cache.fetch(“cache_key”) do  
    Rails.cache.fetch(“cache_key”) do  
    User.some_expensive_query
      User.some_expensive_query
  end
    end
end.real
  end.real
=> 20.5s
  => 20.5s

Latest revision as of 04:21, 18 September 2014

 Benchmark.measure do
   Rails.cache.fetch(“cache_key”) do 
     User.some_expensive_query
   end
 end.real
 => 20.5s