edge badge
Methods
#
C
D
E
K
L
N
Included Modules
Class Public methods
new(max = 1000)
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 6
def initialize(max = 1000)
  @cache = Hash.new { |h,pid| h[pid] = {} }
  @max = max
end
Instance Public methods
[](key)
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 19
def [](key)
  cache[key]
end
[]=(sql, stmt)
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 27
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 34
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 41
def delete(key)
  dealloc cache[key]
  cache.delete(key)
end
each(&block)
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 11
def each(&block)
  cache.each(&block)
end
key?(key)
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 15
def key?(key)
  cache.key?(key)
end
length()
# File activerecord/lib/active_record/connection_adapters/statement_pool.rb, line 23
def length
  cache.length
end