static void WarmLogCache(char* dbPath) { char buf[4096]; #ifdef _WIN32 BOOL next; WIN32_FIND_DATA FindFileData; HANDLE hFind; snprintf(buf, SIZE(buf), "%s/log.*", dbPath); strrep(buf, '/', '\\'); hFind = FindFirstFile(buf, &FindFileData); if (hFind == INVALID_HANDLE_VALUE) return; next = true; while (next) { snprintf(buf, SIZE(buf), "%s/%s", dbPath, FindFileData.cFileName); strrep(buf, '/', '\\'); WarmFileCache(buf, 11000000); next = FindNextFile(hFind, &FindFileData); } FindClose(hFind); #else snprintf(buf, SIZE(buf), "cat %s/log.* > /dev/null 2> /dev/null", dbPath); system(buf); #endif }
static void WarmCDatabaseCache(char* dbPath, unsigned cacheSize) { char filepath[4096]; snprintf(filepath, SIZE(filepath), "%s/keyspace", dbPath); WarmFileCache(filepath, cacheSize); }