Module: ActiveRecord::RuntimeRegistry

Extended by:
RuntimeRegistry
Included in:
RuntimeRegistry
Defined in:
activerecord/lib/active_record/runtime_registry.rb

Overview

This is a thread locals registry for Active Record. For example:

ActiveRecord::RuntimeRegistry.sql_runtime

returns the connection handler local to the current unit of execution (either thread of fiber).

Instance Method Summary collapse

Instance Method Details

#resetObject



20
21
22
23
# File 'activerecord/lib/active_record/runtime_registry.rb', line 20

def reset
  rt, self.sql_runtime = sql_runtime, 0.0
  rt
end

#sql_runtimeObject



12
13
14
# File 'activerecord/lib/active_record/runtime_registry.rb', line 12

def sql_runtime
  ActiveSupport::IsolatedExecutionState[:active_record_sql_runtime] ||= 0.0
end

#sql_runtime=(runtime) ⇒ Object



16
17
18
# File 'activerecord/lib/active_record/runtime_registry.rb', line 16

def sql_runtime=(runtime)
  ActiveSupport::IsolatedExecutionState[:active_record_sql_runtime] = runtime
end