Methods
Class Public methods
Source: show
# File activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 189 def initialize(connection, max = 1000) super @cache = Hash.new { |h,pid| h[pid] = {} } end
Instance Public methods
Source: show
# File activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 196 def [](key); cache[key]; end
Source: show
# File activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 200 def []=(sql, key) while @max <= cache.size cache.shift.last[:stmt].close end cache[sql] = key end
Source: show
# File activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 207 def clear cache.values.each do |hash| hash[:stmt].close end cache.clear end
Source: show
# File activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 198 def delete(key); cache.delete(key); end
Source: show
# File activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 194 def each(&block); cache.each(&block); end
Source: show
# File activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 195 def key?(key); cache.key?(key); end
Source: show
# File activerecord/lib/active_record/connection_adapters/mysql_adapter.rb, line 197 def length; cache.length; end