Class: ActiveRecord::ConnectionAdapters::ConnectionPool::WeakThreadKeyMap
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::ConnectionPool::WeakThreadKeyMap
- Defined in:
- lib/active_record/connection_adapters/abstract/connection_pool.rb
Overview
:nodoc:
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #clear ⇒ Object
-
#initialize ⇒ WeakThreadKeyMap
constructor
FIXME: On 3.3 we could use ObjectSpace::WeakKeyMap but it currently cause GC crashes: github.com/byroot/rails/pull/3.
Constructor Details
#initialize ⇒ WeakThreadKeyMap
FIXME: On 3.3 we could use ObjectSpace::WeakKeyMap but it currently cause GC crashes: github.com/byroot/rails/pull/3
124 125 126 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 124 def initialize @map = {} end |
Instance Method Details
#[](key) ⇒ Object
132 133 134 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 132 def [](key) @map[key] end |
#[]=(key, value) ⇒ Object
136 137 138 139 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 136 def []=(key, value) @map.select! { |c, _| c.alive? } @map[key] = value end |
#clear ⇒ Object
128 129 130 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 128 def clear @map.clear end |