rename compile to build and added sql_hash to query_context

This commit is contained in:
2026-04-06 11:52:55 +02:00
parent 57246d8742
commit d59b41d06c
6 changed files with 18 additions and 18 deletions
+3 -4
View File
@@ -151,10 +151,9 @@ statement_cache::statement_cache(utils::message_bus &bus, connection_pool &pool,
utils::result<statement, utils::error> statement_cache::acquire(const query_context& ctx) {
std::unique_lock lock(mutex_);
// hash statement
const auto key = std::hash<std::string>{}(ctx.sql);
const auto now = std::chrono::steady_clock::now();
// Found in cache. Move it to of the LRU list
if (const auto it = cache_map_.find(key); it != cache_map_.end()) {
if (const auto it = cache_map_.find(ctx.sql_hash); it != cache_map_.end()) {
usage_list_.splice(usage_list_.begin(), usage_list_, it->second.position);
it->second.last_access = now;
bus_.publish<statement_accessed_event>({ctx.sql, std::chrono::steady_clock::now()});
@@ -181,9 +180,9 @@ utils::result<statement, utils::error> statement_cache::acquire(const query_cont
bus_.publish<statement_evicted_event>({ctx.sql, std::chrono::steady_clock::now()});
}
usage_list_.push_front(key);
usage_list_.push_front(ctx.sql_hash);
const auto it = cache_map_.insert({
key,
ctx.sql_hash,
{statement{
std::make_shared<internal::statement_cache_proxy>(bus_, std::move(stmt), pool_, id)},
std::chrono::steady_clock::now(),