]> git.treefish.org Git - phys/latlib.git/blobdiff - hypercache.cpp
only storing concurrent config file HASHES instead of full names.
[phys/latlib.git] / hypercache.cpp
index 16de2a2dcc62db7b86a2bff5dcb000fc1703fdbe..b025ba69822763723c7478271a1b037538cc861e 100644 (file)
@@ -5,7 +5,7 @@ configcache *hypercache::C = NULL;
 vector<hypercache::para> hypercache::delayedParaAdd;
 vector<hypercache::para> hypercache::delayedParaSet;
 string hypercache::activeCFile = "";
-vector<string> hypercache::parentConfigs;
+vector<unsigned long> hypercache::parentConfigs;
 writeout *hypercache::out = NULL;
 
 void hypercache::initCache(configcache **cache,
@@ -88,8 +88,10 @@ void hypercache::writeC() {
 }
 
 void hypercache::writeO() {
-  if ( activeCFile != "" )
-    O->writeHeader("concurrent_cfile", activeCFile.c_str(), (activeCFile.length()+1)*sizeof(char));
+  if ( activeCFile != "" ) {
+    unsigned long afilehash = configcache::hash(activeCFile);
+    O->writeHeader("concurrent_cfile", (char*)(&afilehash), sizeof(unsigned long));
+  }
 
   O->writeConfig(); 
 }
@@ -98,7 +100,7 @@ bool hypercache::readO() {
   bool readret;
 
   if ( readret = O->readConfig() ) {
-    char *parentconfig = (char*)O->getHeader("concurrent_cfile");
+    unsigned long *parentconfig = (unsigned long*)O->getHeader("concurrent_cfile");
     if ( parentconfig != NULL )
       addParentConfig(parentconfig);
   }
@@ -106,10 +108,10 @@ bool hypercache::readO() {
   return readret;
 }
 
-void hypercache::addParentConfig(const char* parentconfig) {
-  for (vector<string>::iterator parit = parentConfigs.begin(); parit != parentConfigs.end(); ++parit)
-    if ( *parit == parentconfig )
+void hypercache::addParentConfig(const unsigned long *parentconfig) {
+  for (vector<unsigned long>::iterator parit = parentConfigs.begin(); parit != parentConfigs.end(); ++parit)
+    if ( *parit == *parentconfig )
       return;
 
-  parentConfigs.push_back(parentconfig);
+  parentConfigs.push_back(*parentconfig);
 }