MCPcopy Create free account
hub / github.com/alibaba/zvec / put_into_cache

Method put_into_cache

src/db/sqlengine/parser/zvec_cached_sql_parser.cc:67–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void ZVecCachedSQLParser::put_into_cache(const std::string &query_cache_key,
68 const SQLInfo::Ptr &new_sql_info) {
69 {
70 std::unique_lock guard(shared_mutex_);
71 if (sql_info_map_.size() >= cache_count_) {
72 // if full, clear to refresh new sql
73 sql_info_map_.clear();
74 Hit = Miss = 0;
75 }
76 sql_info_map_.emplace(query_cache_key, new_sql_info);
77 }
78
79 LOG_DEBUG("cache emplaced. [%s] [%s] ", query_cache_key.c_str(),
80 new_sql_info->to_string().c_str());
81
82 return;
83}
84
85SQLInfo::Ptr ZVecCachedSQLParser::get_from_cache(const std::string &query,
86 std::string *query_cache_key) {

Callers

nothing calls this directly

Calls 5

c_strMethod · 0.80
sizeMethod · 0.45
clearMethod · 0.45
emplaceMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected