123456789_123456789_123456789_123456789_123456789_

Module: ActiveRecord::RuntimeRegistry

Do not use. This module is for internal use only.
Relationships & Source Files
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 Attribute Summary

Instance Method Summary

Instance Attribute Details

#async_sql_runtime (rw)

[ GitHub ]

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

def async_sql_runtime
  ActiveSupport::IsolatedExecutionState[:active_record_async_sql_runtime] ||= 0.0
end

#async_sql_runtime=(runtime) (rw)

[ GitHub ]

  
# File 'activerecord/lib/active_record/runtime_registry.rb', line 24

def async_sql_runtime=(runtime)
  ActiveSupport::IsolatedExecutionState[:active_record_async_sql_runtime] = runtime
end

#sql_runtime (rw)

[ GitHub ]

  
# 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) (rw)

[ GitHub ]

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

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

Instance Method Details

#reset

[ GitHub ]

  
# File 'activerecord/lib/active_record/runtime_registry.rb', line 28

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