discourse/migrations/lib/database/prepared_statement_cache.rb
Gerhard Schlager a48af2f120
DEV: Store details log entries in converter as JSON (#29778)
Plus small DB related fixes
2024-11-19 23:54:00 +01:00

28 lines
469 B
Ruby

# frozen_string_literal: true
require "lru_redux"
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