33#ifndef GUARD_SQLITE_STATEMENT_CACHE_HPP_INCLUDED
34#define GUARD_SQLITE_STATEMENT_CACHE_HPP_INCLUDED
42#include <unordered_map>
69 sqlite3_stmt *
acquire(sqlite3 *db, std::string_view sql);
70 void release(std::string_view sql, sqlite3_stmt *stmt);
80 sqlite3_stmt *
stmt =
nullptr;
88 std::unordered_map<std::string, iterator>
map_;
Tracks prepared statements by SQL text and hands them out on demand.
statement_cache_config config() const noexcept
std::list< entry > lru_list
statement_cache_config config_
void release(std::string_view sql, sqlite3_stmt *stmt)
std::unordered_map< std::string, iterator > map_
sqlite3_stmt * acquire(sqlite3 *db, std::string_view sql)
lru_list::iterator iterator
void reset(statement_cache_config cfg)
statement_cache(statement_cache_config cfg={})
connection is used to open, close, attach and detach a database. Further it has to be passed to all c...
Configuration knobs for the built-in LRU statement cache.
bool enabled
Disable caching without destroying existing entries.
std::size_t capacity
Maximum cached statements.