Module: ActiveRecord::ConnectionAdapters::QueryCache::CacheSQLWithSqlLogging
- Defined in:
- lib/sql-logging/adapters/cache_extension.rb
Instance Method Summary collapse
Instance Method Details
#cache_sql(sql, binds, &blk) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/sql-logging/adapters/cache_extension.rb', line 5 def cache_sql(sql, binds, &blk) if @query_cache.has_key?(sql) rows = nil elapsed = Benchmark.measure do rows = super(sql, binds, &blk) end msec = elapsed.real * 1000 SqlLogging::Statistics.record_query(sql, "CACHE", msec, rows) rows else super(sql, binds, &blk) end end |