edge badge
Methods
#
C
D
E
K
L
N
Included Modules
Class Public methods
new(connection, max = 1000)
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 6
def initialize(connection, max = 1000)
  @cache = Hash.new { |h,pid| h[pid] = {} }
  @connection = connection
  @max        = max
end
Instance Public methods
[](key)
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 20
def [](key)
  cache[key]
end
[]=(sql, stmt)
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 28
def []=(sql, stmt)
  while @max <= cache.size
    dealloc(cache.shift.last)
  end
  cache[sql] = stmt
end
clear()
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 35
def clear
  cache.each_value do |stmt|
    dealloc stmt
  end
  cache.clear
end
delete(key)
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 42
def delete(key)
  dealloc cache[key]
  cache.delete(key)
end
each(&block)
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 12
def each(&block)
  cache.each(&block)
end
key?(key)
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 16
def key?(key)
  cache.key?(key)
end
length()
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 24
def length
  cache.length
end