Changeset 6202
- Timestamp:
- 02/22/07 08:14:47 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/lib/active_record/query_cache.rb
r6195 r6202 88 88 query_caches[self] = cache 89 89 end 90 91 def cache 92 self.query_cache = QueryCache.new(connection_without_query_cache) 93 yield 94 ensure 95 self.query_cache = nil 96 end 97 90 91 # Use a query cache within the given block. 92 def cache 93 # Don't cache if Active Record is not configured. 94 if ActiveRecord::Base.configurations.blank? 95 yield 96 else 97 begin 98 self.query_cache = QueryCache.new(connection_without_query_cache) 99 yield 100 ensure 101 self.query_cache = nil 102 end 103 end 104 end 105 98 106 def connection 99 107 query_cache || connection_without_query_cache