#include <time.h>
#include <dirent.h>
-configcache::configcache(const string& cacheid, const int& nequi, const int& nskip, const string& datadir, char **configmem, const int& configMemSize){
+configcache::configcache(const string& cacheid, const int& nequi, const int& nskip, const string& datadir, char **configmem, const int& configMemSize, const int& cachemode){
NEQUI = nequi;
NSKIP = nskip;
DATADIR = datadir;
outBuffer = NULL;
inBuffer = NULL;
+ MODE = cachemode;
+
refetchDataFiles = false;
}
switch(iPart)
{
case 1: if(inParts != CACHEID) return false; break;
- case 2: if(atoi(inParts) < NEQUI) return false; break;
- case 3: if(atoi(inParts) < NSKIP) return false; break;
+ case 2: if(atoi(inParts) != NEQUI) return false; break;
+ case 3: if(atoi(inParts) != NSKIP) return false; break;
}
inParts = strtok( NULL, "_");
}
bool configcache::readConfig()
{
- if(DATADIR == "") return false;
+ if(DATADIR == "" || MODE == CACHE_MODE_DISABLED) return false;
if(refetchDataFiles){
refetchDataFiles = false;
void configcache::writeConfig()
{
- if( DATADIR == "") return;
+ if( DATADIR == "" || MODE < 2 ) return;
if(!outFile.is_open()){
time_t secstamp = time(NULL);