Methods
Class Public methods
Source: show
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 252 def initialize(connection, max) super @counter = 0 @cache = Hash.new { |h,pid| h[pid] = {} } end
Instance Public methods
Source: show
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 260 def [](key); cache[key]; end
Source: show
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 267 def []=(sql, key) while @max <= cache.size dealloc(cache.shift.last) end @counter += 1 cache[sql] = key end
Source: show
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 275 def clear cache.each_value do |stmt_key| dealloc stmt_key end cache.clear end
Source: show
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 282 def delete(sql_key) dealloc cache[sql_key] cache.delete sql_key end
Source: show
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 258 def each(&block); cache.each(&block); end
Source: show
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 259 def key?(key); cache.key?(key); end
Source: show
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 261 def length; cache.length; end
Source: show
# File activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 263 def next_key "a#{@counter + 1}" end