VSQLite++ 0.3
Loading...
Searching...
No Matches
sqlite::v2::statement_cache Class Reference

Tracks prepared statements by SQL text and hands them out on demand. More...

#include <statement_cache.hpp>

Collaboration diagram for sqlite::v2::statement_cache:
Collaboration graph

Classes

struct  entry

Public Member Functions

 statement_cache (statement_cache_config cfg={})
sqlite3_stmt * acquire (sqlite3 *db, std::string_view sql)
void release (std::string_view sql, sqlite3_stmt *stmt)
void clear (sqlite3 *db)
void reset (statement_cache_config cfg)
statement_cache_config config () const noexcept

Private Types

using lru_list = std::list<entry>
using iterator = lru_list::iterator

Private Attributes

statement_cache_config config_
lru_list lru_
std::unordered_map< std::string, iteratormap_
std::mutex mutex_

Detailed Description

Tracks prepared statements by SQL text and hands them out on demand.

Definition at line 65 of file statement_cache.hpp.

Member Typedef Documentation

◆ iterator

using sqlite::v2::statement_cache::iterator = lru_list::iterator
private

Definition at line 84 of file statement_cache.hpp.

◆ lru_list

using sqlite::v2::statement_cache::lru_list = std::list<entry>
private

Definition at line 83 of file statement_cache.hpp.

Constructor & Destructor Documentation

◆ statement_cache()

sqlite::v2::statement_cache::statement_cache ( statement_cache_config cfg = {})
explicit

Member Function Documentation

◆ acquire()

sqlite3_stmt * sqlite::v2::statement_cache::acquire ( sqlite3 * db,
std::string_view sql )

◆ clear()

void sqlite::v2::statement_cache::clear ( sqlite3 * db)

◆ config()

statement_cache_config sqlite::v2::statement_cache::config ( ) const
inlinenoexcept

Definition at line 73 of file statement_cache.hpp.

References config_.

◆ release()

void sqlite::v2::statement_cache::release ( std::string_view sql,
sqlite3_stmt * stmt )

◆ reset()

void sqlite::v2::statement_cache::reset ( statement_cache_config cfg)

Member Data Documentation

◆ config_

statement_cache_config sqlite::v2::statement_cache::config_
private

Definition at line 86 of file statement_cache.hpp.

Referenced by config().

◆ lru_

lru_list sqlite::v2::statement_cache::lru_
private

Definition at line 87 of file statement_cache.hpp.

◆ map_

std::unordered_map<std::string, iterator> sqlite::v2::statement_cache::map_
private

Definition at line 88 of file statement_cache.hpp.

◆ mutex_

std::mutex sqlite::v2::statement_cache::mutex_
mutableprivate

Definition at line 89 of file statement_cache.hpp.


The documentation for this class was generated from the following file: