summaryrefslogtreecommitdiff
path: root/src/ModuleCache.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2012-02-14 00:30:39 (GMT)
committerMarius Kintel <marius@kintel.net>2012-02-15 00:32:38 (GMT)
commit7b9b798fdcc507a581735ceb3396a53d0ce71652 (patch)
tree6943aaa8d4e880c94441b00c7e98a8fbd2ca828e /src/ModuleCache.cc
parentabcd702a6812abb77317d6fab4f3bdacc273b463 (diff)
Started on sanitizing compile handling in mainwindow
Diffstat (limited to 'src/ModuleCache.cc')
-rw-r--r--src/ModuleCache.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ModuleCache.cc b/src/ModuleCache.cc
index 59424d4..7a0fe51 100644
--- a/src/ModuleCache.cc
+++ b/src/ModuleCache.cc
@@ -1,14 +1,21 @@
#include "ModuleCache.h"
#include "module.h"
#include "printutils.h"
-#include "boosty.h"
#include "openscad.h"
+#include "boosty.h"
+#include <boost/format.hpp>
+#include <boost/filesystem.hpp>
+
#include <stdio.h>
#include <fstream>
#include <sstream>
#include <sys/stat.h>
+/*!
+ FIXME: Implement an LRU scheme to avoid having an ever-growing module cache
+*/
+
ModuleCache *ModuleCache::inst = NULL;
Module *ModuleCache::evaluate(const std::string &filename)
@@ -20,9 +27,7 @@ Module *ModuleCache::evaluate(const std::string &filename)
memset(&st, 0, sizeof(struct stat));
stat(filename.c_str(), &st);
- std::stringstream idstream;
- idstream << std::hex << st.st_mtime << "." << st.st_size;
- std::string cache_id = idstream.str();
+ std::string cache_id = str(boost::format("%x.%x") % st.st_mtime % st.st_size);
// Lookup in cache
if (this->entries.find(filename) != this->entries.end() &&
contact: Jan Huwald // Impressum