Skip to content

Commit eccf9fc

Browse files
Disable cache outside transactions
1 parent 8d609f3 commit eccf9fc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

sqlitecluster/SQLite.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ bool SQLite::read(const string& query, SQResult& result, bool skipInfoWarn) cons
511511
} else {
512512
_isDeterministicQuery = true;
513513
queryResult = !SQuery(_db, "read only query", query, result, 2000 * STIME_US_PER_MS, skipInfoWarn);
514-
if (_isDeterministicQuery && queryResult) {
514+
if (_isDeterministicQuery && queryResult && insideTransaction()) {
515515
_queryCache.emplace(make_pair(query, result));
516516
}
517517
}

sqlitecluster/SQLite.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class SQLite {
216216
const string getMostRecentSQLiteErrorLog() const;
217217

218218
// Returns true if we're inside an uncommitted transaction.
219-
bool insideTransaction() { return _insideTransaction; }
219+
bool insideTransaction() const { return _insideTransaction; }
220220

221221
// Looks up the exact SQL of a paricular commit to the database, as well as gets the SHA1 hash of the database
222222
// immediately following tha commit.

0 commit comments

Comments
 (0)