Class: ActiveRecordMultipleQueryCache::Rails4QueryCache
- Inherits:
-
Base
- Object
- Base
- ActiveRecordMultipleQueryCache::Rails4QueryCache
show all
- Defined in:
- lib/active_record_multiple_query_cache/rails4_query_cache.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#call(env) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/active_record_multiple_query_cache/rails4_query_cache.rb', line 11
def call(env)
connection = active_record_base_class.connection
enabled = connection.query_cache_enabled
connection_id = active_record_base_class.connection_id
connection.enable_query_cache!
response = @app.call(env)
response[2] = Rack::BodyProxy.new(response[2]) do
restore_query_cache_settings(connection_id, enabled)
end
response
rescue Exception
restore_query_cache_settings(connection_id, enabled)
raise
end
|
#name ⇒ Object
28
29
30
|
# File 'lib/active_record_multiple_query_cache/rails4_query_cache.rb', line 28
def name
self.class.name
end
|
#new(app) ⇒ Object
6
7
8
9
|
# File 'lib/active_record_multiple_query_cache/rails4_query_cache.rb', line 6
def new(app)
@app = app
self
end
|
#to_s ⇒ Object
32
33
34
|
# File 'lib/active_record_multiple_query_cache/rails4_query_cache.rb', line 32
def to_s
%{#<#{self.class} active_record_class: "#{active_record_base_class}">}
end
|