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
123 124 125 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 123 def initialize @map = {} end |
Instance Method Details
#[](key) ⇒ Object
131 132 133 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 131 def [](key) @map[key] end |
#[]=(key, value) ⇒ Object
135 136 137 138 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 135 def []=(key, value) @map.select! { |c, _| c.alive? } @map[key] = value end |
#clear ⇒ Object
127 128 129 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 127 def clear @map.clear end |