From: James Turner Date: Sat, 19 Jan 2013 13:58:22 +0000 (+0000) Subject: Increase the nav-cache in-memory cache size. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a138952ee5ea02976d54924d74f2c370c5596c4b;p=flightgear.git Increase the nav-cache in-memory cache size. (Avoid thrash in certain cases) --- diff --git a/src/Navaids/NavDataCache.cxx b/src/Navaids/NavDataCache.cxx index a79778c70..0a09c3187 100644 --- a/src/Navaids/NavDataCache.cxx +++ b/src/Navaids/NavDataCache.cxx @@ -72,7 +72,8 @@ namespace { const int MAX_RETRIES = 10; const int SCHEMA_VERSION = 6; - +const int CACHE_SIZE_KBYTES= 16000; + // bind a std::string to a sqlite statement. The std::string must live the // entire duration of the statement execution - do not pass a temporary // std::string, or the compiler may delete it, freeing the C-string storage, @@ -248,6 +249,11 @@ public: } } + // see http://www.sqlite.org/pragma.html#pragma_cache_size + // for the details, small cache would cause thrashing. + std::ostringstream q; + q << "PRAGMA cache_size=-" << CACHE_SIZE_KBYTES << ";"; + runSQL(q.str()); prepareQueries(); }