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
#cached_queries_count (rw)
[ GitHub ]# File 'activerecord/lib/active_record/runtime_registry.rb', line 36
def cached_queries_count ActiveSupport::IsolatedExecutionState[:active_record_cached_queries_count] ||= 0 end
#cached_queries_count=(count) (rw)
[ GitHub ]# File 'activerecord/lib/active_record/runtime_registry.rb', line 40
def cached_queries_count=(count) ActiveSupport::IsolatedExecutionState[:active_record_cached_queries_count] = count end
#queries_count (rw)
[ GitHub ]# File 'activerecord/lib/active_record/runtime_registry.rb', line 28
def queries_count ActiveSupport::IsolatedExecutionState[:active_record_queries_count] ||= 0 end
#queries_count=(count) (rw)
[ GitHub ]# File 'activerecord/lib/active_record/runtime_registry.rb', line 32
def queries_count=(count) ActiveSupport::IsolatedExecutionState[:active_record_queries_count] = count 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 44
def reset reset_runtimes reset_queries_count reset_cached_queries_count end
#reset_cached_queries_count
[ GitHub ]# File 'activerecord/lib/active_record/runtime_registry.rb', line 62
def reset_cached_queries_count qc = cached_queries_count self.cached_queries_count = 0 qc end
#reset_queries_count
[ GitHub ]# File 'activerecord/lib/active_record/runtime_registry.rb', line 56
def reset_queries_count qc = queries_count self.queries_count = 0 qc end
#reset_runtimes
[ GitHub ]# File 'activerecord/lib/active_record/runtime_registry.rb', line 50
def reset_runtimes rt, self.sql_runtime = sql_runtime, 0.0 self.async_sql_runtime = 0.0 rt end