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::WeakKeyMap
but it currently cause 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 cause GC crashes: github.com/byroot/rails/pull/3
# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 123
def initialize @map = {} end
Instance Method Details
#[](key)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 131
def [](key) @map[key] end
#[]=(key, value)
[ GitHub ]# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 135
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 127
def clear @map.clear end