Class: ActiveRecord::ConnectionAdapters::ConnectionPool::WeakThreadKeyMap
    Do not use.  This class is for internal use only.
  
| Relationships & Source Files | |
| Inherits: | Object | 
| Defined in: | activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb | 
Class Method Summary
- 
    
      .new  ⇒ WeakThreadKeyMap 
    
    constructor
    FIXME: On 3.3 we could use ObjectSpace::WeakKeyMapbut it currently causes GC crashes: github.com/byroot/rails/pull/3.
Instance Method Summary
Constructor Details
    .new  ⇒ WeakThreadKeyMap 
  
FIXME: On 3.3 we could use ObjectSpace::WeakKeyMap but it currently causes GC crashes: github.com/byroot/rails/pull/3
# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 129
def initialize @map = {} end
Instance Method Details
#[](key)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 137
def [](key) @map[key] end
#[]=(key, value)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 141
def []=(key, value) @map.select! { |c, _| c&.alive? } @map[key] = value end
#clear
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 133
def clear @map.clear end