discourse/migrations/lib/database/prepared_statement_cache.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
448 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Migrations::Database
class PreparedStatementCache < LruRedux::Cache
class PreparedStatementHash < Hash
def shift
result = super
if (stmt = result[1])
stmt.close
end
result
end
def clear
each_value(&:close)
super
end
end
def initialize(*args)
super
@data = PreparedStatementHash.new
end
end
end