root/tags/rel_2-0-2/activerecord/lib/active_record/query_cache.rb
| Revision 8329, 510 bytes (checked in by david, 1 year ago) |
|---|
| Line | |
|---|---|
| 1 | module ActiveRecord |
| 2 | module QueryCache |
| 3 | # Enable the query cache within the block if Active Record is configured. |
| 4 | def cache(&block) |
| 5 | if ActiveRecord::Base.configurations.blank? |
| 6 | yield |
| 7 | else |
| 8 | connection.cache(&block) |
| 9 | end |
| 10 | end |
| 11 | |
| 12 | # Disable the query cache within the block if Active Record is configured. |
| 13 | def uncached(&block) |
| 14 | if ActiveRecord::Base.configurations.blank? |
| 15 | yield |
| 16 | else |
| 17 | connection.uncached(&block) |
| 18 | end |
| 19 | end |
| 20 | end |
| 21 | end |
Note: See TracBrowser for help on using the browser.